summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* [CodeGen] Don't evaluate immediate inlineasm arguments using isICE().Ahmed Bougacha2015-06-131-1/+1
| | | | | | | | | | | Instead, just EvaluateAsInt(). Follow-up to r239549: rsmith points out that isICE() is expensive; seems like it's not the right concept anyway, as it fails on `static const' in C, and will actually trigger the assert below on: test/Sema/inline-asm-validate-x86.c llvm-svn: 239651
* [CodeGen] Use IRBuilder to create llvm.lifetime intrinsics.Alexey Samsonov2015-06-121-9/+6
| | | | | | | | | | | | | | | | | | | | Summary: In addition to easier syntax, IRBuilder makes sure to set correct debug locations for newly added instructions (bitcast and llvm.lifetime itself). This restores the original behavior, which was modified by r234581 (reapplied as r235553). Extend one of the tests to check for debug locations. Test Plan: regression test suite Reviewers: aadg, dblaikie Subscribers: cfe-commits, majnemer Differential Revision: http://reviews.llvm.org/D10418 llvm-svn: 239643
* [CGCall] Fix potential invalid iterator decrement in ↵Alexey Samsonov2015-06-121-5/+4
| | | | | | | | | | | findDominatingStoreToReturnValue. If llvm.lifetime.end turns out to be the first instruction in the last basic block, we can decrement the iterator twice, going past rend. At the moment, this can never happen because llvm.lifetime.end always goes immediately after bitcast, but relying on this is very brittle. llvm-svn: 239638
* push_back() loop -> append() for random access iterators.Benjamin Kramer2015-06-121-7/+3
| | | | | | | append will resize the vector to the optimal size. No functional change intended. llvm-svn: 239607
* Revert commit r239481 as it is dependent on reverted llvm commit r239480.Teresa Johnson2015-06-121-1/+0
| | | | llvm-svn: 239588
* Handle fpmath= in the target attribute.Eric Christopher2015-06-121-0/+5
| | | | | | | | | | Right now we're ignoring the fpmath attribute since there's no backend support for a feature like this and to do so would require checking the validity of the strings and doing general subtarget feature parsing of valid and invalid features with the target attribute feature. llvm-svn: 239582
* Handle -mno-<feature> in target attribute strings by replacing theEric Christopher2015-06-121-2/+4
| | | | | | | -mno- with a -<feature> to match how we handle this in the rest of the frontend. llvm-svn: 239581
* Add support for tune= to the target attribute support by ignoring it.Eric Christopher2015-06-121-0/+3
| | | | | | | We don't currently support the -mtune option in any useful way so ignoring the annotation is fine. llvm-svn: 239580
* Add support for the the target attribute.Eric Christopher2015-06-121-11/+39
| | | | | | | | | | | | | | | Modeled after the gcc attribute of the same name, this feature allows source level annotations to correspond to backend code generation. In llvm particular parlance, this allows the adding of subtarget features and changing the cpu for a particular function based on source level hints. This has been added into the existing support for function level attributes without particular verification for any target outside of whether or not the backend will support the features/cpu given (similar to section, etc). llvm-svn: 239579
* [IRGen] Fix the MSVC2013 buildDavid Majnemer2015-06-121-1/+2
| | | | llvm-svn: 239576
* Add assume_safety option for pragma loop vectorize and interleave.Tyler Nowicki2015-06-113-6/+37
| | | | | | | | Specifying #pragma clang loop vectorize(assume_safety) on a loop adds the mem.parallel_loop_access metadata to each load/store operation in the loop. This metadata tells loop access analysis (LAA) to skip memory dependency checking. llvm-svn: 239572
* [CodeGen] Emit Constants for immediate inlineasm arguments.Ahmed Bougacha2015-06-111-0/+10
| | | | | | | | | | | | | | | | | For inline assembly immediate constraints, we currently always use EmitScalarExpr, instead of directly emitting the constant. When the overflow sanitizer is enabled, this generates overflow intrinsics instead of constants. Instead, emit a constant for constraints that either require an immediate (e.g. 'I' on X86), or only accepts constants (immediate or symbolic; i.e., don't accept registers or memory). Fixes PR19763. Differential Revision: http://reviews.llvm.org/D10255 llvm-svn: 239549
* add the -mrecip driver flag and process its options (3rd try)Sanjay Patel2015-06-111-0/+3
| | | | | | | | | | | | | | | | | | | The 1st and 2nd tries to land this (r238055, r238851) were reverted due to bot failures caused by the LLVM part of the patch. That was hopefully fixed after r239001. This is the front-end counterpart to D8982. The -mrecip option interface is based on maintaining compatibility with gcc: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627 https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289 ...while adding more functionality (allowing users to specify the number of refinement steps for each estimate type). Differential Revision: http://reviews.llvm.org/D8989 llvm-svn: 239536
* C++11 rangify several loops.Yaron Keren2015-06-111-36/+21
| | | | llvm-svn: 239528
* [OPENMP] Fox for http://llvm.org/PR23663: OpenMP crashAlexey Bataev2015-06-111-24/+26
| | | | | | Destroy RuntimeCleanupScope before generation of termination instruction in parallel loop precondition. llvm-svn: 239524
* Reinstate r239499 and r239503David Majnemer2015-06-111-19/+9
| | | | | | | They were reverted because the FileCheck patterns didn't match on release builds. llvm-svn: 239512
* Revert "[MS ABI] Allow fastcall member function pointers to get CodeGen'd"Manuel Klimek2015-06-111-9/+19
| | | | | | | | | | | | Revert "[MS ABI] Allow memfn pointers with unconvertible types to be formed" This reverts r239499 and r239503; the former breaks tests [1] and the latter is based on the former. [1] http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/4473/testReport/Clang/CodeGenCXX/microsoft_abi_virtual_member_pointers_cpp/ llvm-svn: 239511
* [MS ABI] Allow fastcall member function pointers to get CodeGen'dDavid Majnemer2015-06-111-14/+9
| | | | | | | This restriction appears unnecessary and most likely came about during early work for musttail. llvm-svn: 239500
* [MS ABI] Allow memfn pointers with unconvertible types to be formedDavid Majnemer2015-06-111-6/+1
| | | | | | | | Remove the restriction which forbade forming pointers to member functions which had parameter types or return types which were not convertible. llvm-svn: 239499
* Pass down the -flto option to the -cc1 job, and from there into theTeresa Johnson2015-06-101-0/+1
| | | | | | | | | | | | CodeGenOptions and onto the PassManagerBuilder. This enables gating the new EliminateAvailableExternally module pass on whether we are preparing for LTO. If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not included as we want to preserve available externally functions for possible link time inlining. llvm-svn: 239481
* add ConstEvaluatedExprVisitorScott Douglass2015-06-101-5/+5
| | | | | | Differential Revision: http://reviews.llvm.org/D10210 llvm-svn: 239474
* Implementing C99 partial re-initialization behavior (DR-253)Yunzhong Gao2015-06-103-0/+189
| | | | | | | | | | | | | | | | | | | | | | | | | Based on previous discussion on the mailing list, clang currently lacks support for C99 partial re-initialization behavior: Reference: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-April/029188.html Reference: http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_253.htm This patch attempts to fix this problem. Given the following code snippet, struct P1 { char x[6]; }; struct LP1 { struct P1 p1; }; struct LP1 l = { .p1 = { "foo" }, .p1.x[2] = 'x' }; // this example is adapted from the example for "struct fred x[]" in DR-253; // currently clang produces in l: { "\0\0x" }, // whereas gcc 4.8 produces { "fox" }; // with this fix, clang will also produce: { "fox" }; Differential Review: http://reviews.llvm.org/D5789 llvm-svn: 239446
* Attach attribute "disable-tail-calls" to the functions in the IR.Akira Hatanaka2015-06-092-2/+2
| | | | | | | | | | | This commit adds back the code that seems to have been dropped unintentionally in r176985. rdar://problem/13752163 Differential Revision: http://reviews.llvm.org/D10100 llvm-svn: 239426
* Revert "Re-land r236052, "[SEH] Add 32-bit lowering code for __try""Reid Kleckner2015-06-093-174/+93
| | | | | | | This reverts commit r239415. This was committed accidentally, LLVM isn't ready for this. llvm-svn: 239417
* Re-land r236052, "[SEH] Add 32-bit lowering code for __try"Reid Kleckner2015-06-093-93/+174
| | | | | | | | This reverts r236167. LLVM should be ready for this now. llvm-svn: 239415
* Eliminate unnecessary namespace to prevent conflicts.Tyler Nowicki2015-06-081-2/+1
| | | | llvm-svn: 239365
* [CodeGen] Reuse stack space from unused function results (with more accurate ↵Leny Kholodov2015-06-083-13/+39
| | | | | | | | | | unused result detection) This patch fixes issues with unused result detection which were found in patch http://reviews.llvm.org/D9743. Differential Revision: http://reviews.llvm.org/D10042 llvm-svn: 239294
* Fix typo of function name.Eric Christopher2015-06-051-1/+1
| | | | llvm-svn: 239194
* Rename the single non-style conformant function in TargetCodeGenInfoEric Christopher2015-06-053-24/+24
| | | | | | and update all callers. llvm-svn: 239193
* C++ 11 rangify for loop.Yaron Keren2015-06-051-4/+3
| | | | llvm-svn: 239140
* C++11 rangify for loop.Yaron Keren2015-06-041-4/+2
| | | | llvm-svn: 239064
* [CodeGen][NEON] Emit constants for "immediate" intrinsic arguments.Ahmed Bougacha2015-06-041-3/+38
| | | | | | | | | | | | | | | | | On ARM/AArch64, we currently always use EmitScalarExpr for the immediate builtin arguments, instead of directly emitting the constant. When the overflow sanitizer is enabled, this generates overflow intrinsics instead of constants, breaking assumptions in various places. Instead, use the knowledge of "immediates" to directly emit a constant: - teach the tablegen backend to emit the "immediate" modifiers - use those modifiers in the NEON CodeGen, on ARM and AArch64. Fixes PR23517. Differential Revision: http://reviews.llvm.org/D10045 llvm-svn: 239002
* Revert "add the -mrecip driver flag and process its options (2nd try)"Rafael Espindola2015-06-031-4/+0
| | | | | | | | This reverts commit r238851. It depends on a llvm commit that was reverted. llvm-svn: 238904
* [x86-64 ABI] Fix for PR23082: an assertion failure when passing/returning a ↵Andrea Di Biagio2015-06-021-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wrapper union in a full YMM register. This patch fixes an assertion failure in method 'X86_64ABIInfo::GetByteVectorType'. Method 'GetByteVectorType' (in TargetInfo.cpp) is responsible for mapping a QualType 'Ty' (for an argument or return value) to an LLVM IR type that, according to the ABI, must be passed in a XMM/YMM vector register. When selecting the IR vector type, method 'GetByteVectorType' always tries to choose the "best" IR vector type for the 'Ty' in input. In particular, if Ty is a wrapper structure, it keeps unwrapping it until it finds a vector type VTy. That VTy is the "preferred IR type". However, function 'isSingleElementStructure' (used to unwrap structures) does not know how to look through union types. So, before this patch, if Ty was in a nest of wrapper structures with at least two union types, we would have triggered an assertion failure (added at revision 230971). With this patch, if method 'GetByteVectorType' fails to find the preferred vector type, we just return a valid (although potentially 'less friendly') vector type based on the type size. So, rather than asserting on an 'unexpected' 'Ty' in input, we conservatively return vector type <2 x double> if Ty is 16 bytes, or <4 x double> if Ty is 32 bytes. Differential Revision: http://reviews.llvm.org/D10190 llvm-svn: 238861
* add missing dependency for CodeGen libSanjay Patel2015-06-021-0/+1
| | | | | | This looks to be exposed on some bots by r238851. llvm-svn: 238855
* add the -mrecip driver flag and process its options (2nd try)Sanjay Patel2015-06-021-0/+4
| | | | | | | | | | | | | | | | | | | The first try to land this (r238055) was reverted due to bot failures caused by the LLVM part of the patch. That was hopefully fixed by r238788, and the LLVM patch was resubmitted at r238842. This is the front-end counterpart to D8982. The -mrecip option interface is based on maintaining compatibility with gcc: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627 https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289 ...while adding more functionality (allowing users to specify the number of refinement steps for each estimate type). Differential Revision: http://reviews.llvm.org/D8989 llvm-svn: 238851
* ubsan: Check for null pointers given to certain builtins, suchNuno Lopes2015-05-303-12/+30
| | | | | | | | | | as memcpy, memset, memmove, and bzero. Reviewed by: Richard Smith Differential Revision: http://reviews.llvm.org/D9673 llvm-svn: 238657
* [CodeGen] Indirect fields can initialize a unionDavid Majnemer2015-05-302-5/+15
| | | | | | | | The first named data member is the field used to default initialize the union. An IndirectFieldDecl can introduce the first named data member of a union. llvm-svn: 238649
* Fix 80-column violations.Eric Christopher2015-05-291-60/+77
| | | | llvm-svn: 238630
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-294-9/+8
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238601
* wip: Remove some unused functionsJustin Bogner2015-05-292-39/+0
| | | | llvm-svn: 238538
* Get the dll storage class right for structors of classes exported/imported ↵Hans Wennborg2015-05-283-13/+25
| | | | | | | | | via explicit instantiation (PR23667) This is a follow-up to r238266. It turned out structors are codegened through a different path, and didn't get the storage class set in EmitGlobalFunctionDefinition. llvm-svn: 238443
* Set function entry counts with -fprofile-instr-use.Diego Novillo2015-05-271-0/+2
| | | | | | This generates function entry counts from instrumentation profiles. llvm-svn: 238360
* [MS ABI, DebugInfo] Omit the size for model-less pointers-to-membersDavid Majnemer2015-05-261-3/+5
| | | | | | | | | | | | | | The representation of a pointer-to-member in the MS ABI is governed by the layout of the relevant class or if a model has been explicitly specified. If no model is specified, then an appropriate "worst-case-scenario" model is implicitly chosen if, and only, if the pointer-to-member type's representation was needed. Debug info cannot force a pointer-to-member type to have a representation so do not try to query the size of such a type unless we know it is safe to do so. llvm-svn: 238259
* [CodeGen] Handle flexible array members containing pointers to membersDavid Majnemer2015-05-264-16/+14
| | | | | | | | | | Types can be classified as being zero-initializable or non-zero-initializable. We used to classify array types by giving them the classification of their base element type. However, incomplete array types are never initialized directly and thus are always zero-initializable. llvm-svn: 238256
* [MIPS] Re-land the change r238200 to fix extension of integer typesPetar Jovanovic2015-05-263-2/+23
| | | | | | | | Re-land the change r238200, but with modifications in the tests that should prevent new failures in some environments as reported with the original change on the mailing list. llvm-svn: 238253
* Remove the code in clang that is using TargetOptions::NoFramePointerElim.Akira Hatanaka2015-05-261-9/+0
| | | | | | This is the clang side change following r238244. llvm-svn: 238245
* Revert r238200: "[MIPS] fix extension of integer types (function calls)"Hans Wennborg2015-05-263-23/+2
| | | | | | mips-unsigned-ext-var.c and mips-unsigned-extend.c fail in some builds. llvm-svn: 238237
* [MIPS] fix extension of integer types (function calls)Petar Jovanovic2015-05-263-2/+23
| | | | | | | | | | On MIPS unsigned int type should not be zero extended but sign-extended. Patch by Strahinja Petrovic. Differential Revision: http://reviews.llvm.org/D9198 llvm-svn: 238200
* This reverts commit r238064 and r238055.Rafael Espindola2015-05-231-4/+0
| | | | | | They depend on a reverted llvm commit. llvm-svn: 238076
OpenPOWER on IntegriCloud