summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Reapply^3 "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-192-9/+12
| | | | | | Sync up with "(llvm) Use Error in InstrProf and Coverage". llvm-svn: 270021
* Update for llvm change.Rafael Espindola2016-05-181-1/+1
| | | | llvm-svn: 269989
* Various improvements to the public IRGen interface.John McCall2016-05-182-32/+62
| | | | llvm-svn: 269880
* [Sema,CodeGen] Remove comment from SemaChecking about a ↵Craig Topper2016-05-181-18/+2
| | | | | | | | builtin_shufflevector form that it doesn't support. Remove CodeGen support for the same form since it could never have been used due to the missing support in Sema. I couldn't find any documentation that this form existed either. Nor is there documentation for one of the remaining two forms, but there is a testcase that uses it. llvm-svn: 269879
* [OPENMP] Pass scalar firstprivate vars by value.Alexey Bataev2016-05-173-23/+43
| | | | | | | | For better performance and to unify code with offloading part we pass scalar firstprivate values by value, instead of by reference. It will remove some extra copying operations. llvm-svn: 269751
* Revert "Reapply^2 "[ProfileData] (clang) Use Error in InstrProf and ↵Vedant Kumar2016-05-162-12/+9
| | | | | | | | Coverage, NFC"" This reverts commit r269695. The llvm commit does not pass the MSVC bot. llvm-svn: 269701
* Reapply^2 "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-162-9/+12
| | | | | | | | Sync up with "(llvm) Use Error in InstrProf and Coverage". Differential Revision: http://reviews.llvm.org/D19902 llvm-svn: 269695
* Change embed-bitcode linkage typeSteven Wu2016-05-161-22/+51
| | | | | | | | | | | Embedded bitcode should have private linkage instead of appending or external. Otherwise, it will cause link failure due to duplicated symbols. Also add llvm.embedded.module and llvm.cmdline to llvm.compiler.used so they don't get optimized out. rdar://problem/21555860 llvm-svn: 269679
* CodeGen: convert some const char * to StringRefSaleem Abdulrasool2016-05-161-33/+21
| | | | | | Convert some use of const char * to StringRef. NFC. llvm-svn: 269630
* Revert "Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, ↵Chandler Carruth2016-05-142-12/+9
| | | | | | | | | | NFC"" This reverts commit r269492 as the corresponding LLVM commit was reverted due to lots of warnings. See the review thread for the original LLVM commit (r269491) for details. llvm-svn: 269549
* Fix some typos.Richard Smith2016-05-141-7/+7
| | | | llvm-svn: 269528
* Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-132-9/+12
| | | | | | | | Sync up with "(llvm) Use Error in InstrProf and Coverage". Differential Revision: http://reviews.llvm.org/D19902 llvm-svn: 269492
* Revert "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-132-12/+9
| | | | | | This reverts commit r269463. It fails two llvm-profdata tests. llvm-svn: 269468
* [MS ABI] Delegating constructors should not assume they are most derivedDavid Majnemer2016-05-131-9/+11
| | | | | | | | A constructor needs to know whether or not it is most derived in order to determine if it is responsible for virtual bases. Delegating constructors assumed they were most derived. llvm-svn: 269465
* [ProfileData] (clang) Use Error in InstrProf and Coverage, NFCVedant Kumar2016-05-132-9/+12
| | | | | | Sync up with "(llvm) Use Error in InstrProf and Coverage". llvm-svn: 269463
* [CodeGen] Clang does not choose aapcs-vfp calling convention for ARM bare ↵Oleg Ranevskyy2016-05-131-1/+2
| | | | | | | | | | | | | | | | | | | metal target with hard float (EABIHF) Summary: Clang does not detect `aapcs-vfp` for the EABIHF environment. The reason is that only GNUEABIHF is considered while choosing calling convention, EABIHF is ignored. This causes clang to use `aapcs` for EABIHF and add the `arm_aapcscc` specifier to functions in generated IR. The modified `arm-cc.c` test checks that no calling convention specifier is added to functions for EABIHF, which means the default one is used (`CallingConv::ARM_AAPCS_VFP`). Reviewers: rengolin, compnerd, t.p.northover Subscribers: aemerson, rengolin, asl, cfe-commits Differential Revision: http://reviews.llvm.org/D20219 llvm-svn: 269419
* [ObjC][CodeGen] Remove an assert that is no longer correct.Akira Hatanaka2016-05-131-3/+10
| | | | | | | | | | | | | | | | | | clang asserts when compiling the following code because r231508 made changes to promote constant temporary arrays and records to globals with constant initializers: std::vector<NSString*> strs = {@"a", @"b"}; This commit changes the code to return early if the object returned by createReferenceTemporary is a global variable with an initializer. rdar://problem/25504992 rdar://problem/25955179 Differential Revision: http://reviews.llvm.org/D20045 llvm-svn: 269385
* [ubsan] Add -fsanitize-undefined-strip-path-components=NFilipe Cabecinhas2016-05-121-1/+28
| | | | | | | | | | | | | | | | | | | Summary: This option allows the user to control how much of the file name is emitted by UBSan. Tuning this option allows one to save space in the resulting binary, which is helpful for restricted execution environments. With a positive N, UBSan skips the first N path components. With a negative N, UBSan only keeps the last N path components. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19666 llvm-svn: 269309
* [MS ABI] Don't crash when zero-initializing a vbase which contains a vbaseDavid Majnemer2016-05-121-0/+3
| | | | | | | | | | | | | | | | Bases can be zero-initialized: the storage is zero-initialized before the base constructor is run. The MS ABI has a quirk where base VBPtrs are not installed by the base constructor but by the most derived class. In particular, they are installed before the base constructor is run. The derived constructor must be careful to zero-initialize only the bits of the class which haven't already been populated by virtual base pointers. While we correctly avoided this scenario, we didn't handle the case where the base class has virtual bases which have virtual bases. llvm-svn: 269271
* Fixed msvc warningsSimon Pilgrim2016-05-111-0/+2
| | | | llvm-svn: 269242
* Preserve the FoundDecl when performing overload resolution for constructors.Richard Smith2016-05-111-0/+1
| | | | | | | | | This is in preparation for C++ P0136R1, which switches the model for inheriting constructors over from synthesizing a constructor to finding base class constructors (via using shadow decls) when looking for derived class constructors. llvm-svn: 269231
* Embed bitcode in object file (clang cc1 part)Steven Wu2016-05-112-0/+96
| | | | | | | | | | | | | | | | | | | Summary: Teach clang to embed bitcode inside bitcode. When -fembed-bitcode cc1 option is used, clang will embed both the input bitcode and cc1 commandline into the bitcode in special sections before compiling to the object file. Using -fembed-bitcode-marker will only introduce a marker in both sections. Depends on D17390 Reviewers: rsmith Subscribers: yaron.keren, vsk, cfe-commits Differential Revision: http://reviews.llvm.org/D17392 llvm-svn: 269202
* Update clang for LLVM API change.Peter Collingbourne2016-05-101-3/+1
| | | | llvm-svn: 269111
* Introduce CGCXXABI::canCallMismatchedFunctionTypeDerek Schuff2016-05-103-4/+16
| | | | llvm-svn: 269089
* more cleanupDerek Schuff2016-05-101-4/+4
| | | | llvm-svn: 269088
* Clarify condition, remove redundant checkDerek Schuff2016-05-101-5/+7
| | | | llvm-svn: 269087
* Clean up condition, add ARM to testDerek Schuff2016-05-101-8/+9
| | | | llvm-svn: 269086
* Do not register incompatible C++ destructors with __cxa_atexitDerek Schuff2016-05-101-3/+7
| | | | | | | | | | | | | | | | | | | | | | Summary: For a static object with a nontrivial destructor, clang generates an initializer function (__cxx_global_var_init) which registers that object's destructor using __cxa_atexit. However some ABIs (ARM, WebAssembly) use destructors that return 'this' instead of having void return (which does not match the signature of function pointers passed to __cxa_atexit). This results in undefined behavior when the destructors are called. All the calling conventions I know of on ARM can tolerate this, but WebAssembly requires the signatures of indirect calls to match the called function. This patch disables that direct registration of destructors for ABIs that have this-returning destructors. Subscribers: aemerson, jfb, cfe-commits, dschuff Differential Revision: http://reviews.llvm.org/D19275 llvm-svn: 269085
* [OPENMP 4.5] Initial codegen for 'priority' clause in task-basedAlexey Bataev2016-05-103-2/+16
| | | | | | | | | directives. OpenMP 4.5 supports clause 'priority' in task-based directives. Patch adds initial codegen support for this clause in codegen. llvm-svn: 269050
* [OPENMP 4.0] Fixed codegen for destructors in task-based directives.Alexey Bataev2016-05-102-16/+30
| | | | | | | | If private variables require destructors call at the deletion of the task, additional flag in task flags must be set. Patch fixes this problem. llvm-svn: 269039
* [OPENMP 4.5] Add codegen support in runtime for '[non]monotonic'Alexey Bataev2016-05-104-65/+95
| | | | | | | | | | schedule modifiers. Runtime library expects some additional data in schedule argument for loop-based directives, that have additional schedule modifiers 'monotonic|nonmonotonic'. llvm-svn: 269035
* [CUDA] Restrict init of local __shared__ variables to empty constructors only.Artem Belevich2016-05-091-2/+8
| | | | | | | | | | Allow only empty constructors for local __shared__ variables in a way identical to restrictions imposed on dynamic initializers for global variables on device. Differential Revision: http://reviews.llvm.org/D20039 llvm-svn: 268982
* Enable support for __float128 in Clang and enable it on pertinent platformsNemanja Ivanovic2016-05-094-7/+19
| | | | | | | | | | | | | | | | | | This patch corresponds to reviews: http://reviews.llvm.org/D15120 http://reviews.llvm.org/D19125 It adds support for the __float128 keyword, literals and target feature to enable it. Based on the latter of the two aforementioned reviews, this feature is enabled on Linux on i386/X86 as well as SystemZ. This is also the second attempt in commiting this feature. The first attempt did not enable it on required platforms which caused failures when compiling type_traits with -std=gnu++11. If you see failures with compiling this header on your platform after this commit, it is likely that your platform needs to have this feature enabled. llvm-svn: 268898
* [OpenMP] Check for associated statements with hasAssociatedStmt() when ↵Samuel Antao2016-05-081-1/+1
| | | | | | | | | | | | | | scanning for device code. Summary: `getAssociatedStmt()` contains an assertion that assumes the statement always exists. In device code scanning, we need to look into the associated statement therefore we check its existence. This patch replaces `getAssociatedStmt` by `hasAssociatedStmt` so that we do not trigger the assertion for directives that happen not to have an associated statement (e.g target enter/exit data). Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: cfe-commits, caomhin Differential Revision: http://reviews.llvm.org/D19812 llvm-svn: 268870
* Revert "AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels."Nikolay Haustov2016-05-061-8/+0
| | | | | | | | This reverts commit f7053ec90d0fc56f0837e43c2c759e85b56c21a1. It broke calling OpenCL kernel from another kernel. llvm-svn: 268740
* Adding omitted column to invalid loc diagnostic.Ben Craig2016-05-061-1/+1
| | | | | | | | | | | note_fe_backend_invalid_loc expects three arguments (file, line, column), and will assert when only given two. The other two places in this file that use note_fe_backend_invalid_loc already supply the Column for the third parameter. http://reviews.llvm.org/D19936 llvm-svn: 268732
* [OPENMP 4.0] Codegen for 'declare simd' directive.Alexey Bataev2016-05-063-0/+234
| | | | | | | | | OpenMP 4.0 adds support for elemental functions using declarative directive '#pragma omp declare simd'. Patch adds mangling for simd functions in accordance with https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt llvm-svn: 268721
* AMDGPU/SI: Use amdgpu_kernel calling convention for OpenCL kernels.Nikolay Haustov2016-05-061-0/+8
| | | | | | | | | | Reviewers: tstellarAMD, arsenm Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19918 llvm-svn: 268718
* [OPENMP 4.5] Codegen for 'lastprivate' clauses in 'taskloop' directives.Alexey Bataev2016-05-053-84/+273
| | | | | | | OpenMP 4.5 adds taskloop/taskloop simd directives. These directives allow to use lastprivate clause. Patch adds codegen for this clause. llvm-svn: 268618
* [SystemZ] Add -mbackchain option.Marcin Koscielnicki2016-05-041-0/+2
| | | | | | | | | This option, like the corresponding gcc option, is SystemZ-specific and enables storing frame backchain links, as specified in the ABI. Differential Revision: http://reviews.llvm.org/D19891 llvm-svn: 268575
* [CodeGenObjCXX] Fix handling of blocks in lambda.Akira Hatanaka2016-05-041-26/+24
| | | | | | | | | | | This fixes a crash that occurs when a block captures a reference that is captured by its enclosing lambda. rdar://problem/18586651 Differential Revision: http://reviews.llvm.org/D19536 llvm-svn: 268532
* [Coverage] Fix an issue where a coverage region might not be created for a ↵Igor Kudrin2016-05-041-3/+19
| | | | | | | | | | | macro containing a loop statement. The issue happened when a macro contained a full for or while statement, which body ended at the end of the macro. Differential Revision: http://reviews.llvm.org/D19725 llvm-svn: 268511
* [modules][debuginfo] Only include imported modules when targeting LLDBDavid Blaikie2016-05-032-0/+3
| | | | | | | | | | | | | | | | | These constructs are only applicable to a debugger capable of loading a Clang AST, so omit them for brevity when not doing so. We could potentially propagate more of CodeGenOptions through the ObjectFilePCGContainerOperations for consistency (so the next person who adds some CodeGenOpts feature that tweaks debug info output doesn't get caught by this), so I'm open to objections/alternatives there, but went with this for now. Tested just a couple of basic cases (one direct, one indirect (through the ObjectFilePCHContainerOperations) & fixed up other cases to pass the -debugger-tuning flag as appropriate. llvm-svn: 268460
* AArch64: fixup comment after changeTim Northover2016-05-031-1/+1
| | | | llvm-svn: 268423
* AArch64: simplify illegal vector check. NFC.Tim Northover2016-05-031-1/+1
| | | | | | | | Use a utility function to check whether the number of elements is a power of 2 and drop the redundant upper limit (a 128-bit vector with more than 16 elements would have each element < 8 bits, not possible). llvm-svn: 268422
* [MS] Pass CalleeDecl to adjustThisArgumentForVirtualFunctionCallReid Kleckner2016-05-031-1/+1
| | | | | | | | | | If we are devirtualizing, then we want to compute the 'this' adjustment of the devirtualized target, not the adjustment of the base's method definition, which is usually zero. Fixes PR27621 llvm-svn: 268418
* Fix argument expansion of reference fields of structsReid Kleckner2016-05-022-1/+5
| | | | | | | | | | | | | | | | | | | r268261 made Clang "expand" more struct arguments on Windows. It removed the check for 'RD->isCLike()', which was preventing us from attempting to expand structs with reference type fields. Our expansion code was attempting to load and pass each field of the type in turn. We were accidentally doing one to many loads on reference type fields. On the function prologue side, we can use EmitLValueForFieldInitialization, which obviously gets the address of the field. On the call side, I tweaked EmitRValueForField directly, since this is the only use of this method. Fixes PR27607 llvm-svn: 268321
* Remove unneeded test in tryCaptureAsConstant.Akira Hatanaka2016-05-021-4/+4
| | | | | | | | It isn't necessary to call hasDefaultArg because we can't rematerialize a captured variable that is a function parameter, regardless of whether or not it has a default argument. NFC. llvm-svn: 268318
* [CodeGenObjCXX] Don't rematerialize default arguments of functionAkira Hatanaka2016-05-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | parameters in the body of a block. This fixes a bug where clang would materialize the default argument inside the body of a block instead of passing the value via the block descriptor. For example, in the code below, foo1 would always print 42 regardless of the value of argument "a" passed to foo1. void foo1(const int a = 42 ) { auto block = ^{ printf("%d\n", a); }; block(); } rdar://problem/24449235 llvm-svn: 268314
* Expand aggregate arguments more often on 32-bit WindowsReid Kleckner2016-05-021-83/+89
| | | | | | | | | | | | | | | | | | | | Before this change, we would pass all non-HFA record arguments on Windows with byval. Byval often blocks optimizations and results in bad code generation. Windows now uses the existing workaround that other x86_32 platforms use. I also expanded the workaround to handle C++ records with constructors on Windows. On non-Windows platforms, we have to keep generating the same LLVM IR prototypes if we want our bitcode to be ABI compatible. Otherwise we will encounter mismatch issues like PR21573. Essentially fixes PR27522 in Clang instead of LLVM. Reviewers: hans Differential Revision: http://reviews.llvm.org/D19756 llvm-svn: 268261
OpenPOWER on IntegriCloud