summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Default vaarg lowering should support indirect struct types.James Y Knight2016-02-243-20/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes PR11517 for SPARC. On most targets, clang lowers va_arg itself, eschewing the use of the llvm vaarg instruction. This is necessary (at least for now) as the type argument to the vaarg instruction cannot represent all the ABI information that is needed to support complex calling conventions. However, on targets with a simpler varrags ABIs, the LLVM instruction can work just fine, and clang can simply lower to it. Unfortunately, even on such targets, vaarg with a struct argument would fail, because the default lowering to vaarg was naive: it didn't take into account the ABI attribute computed by classifyArgumentType. In particular, for the DefaultABIInfo, structs are supposed to be passed indirectly and so llvm's vaarg instruction should be emitted with a pointer argument. Now, vaarg instruction emission is able to use computed ABIArgInfo for the provided argument type, which allows the default ABI support to work for structs too. I haven't touched the EmitVAArg implementation for PPC32_SVR4 or XCore, although I believe both are now redundant, and could be switched over to use the default implementation as well. Differential Revision: http://reviews.llvm.org/D16154 llvm-svn: 261717
* Reapply r261657.Adrian Prantl2016-02-231-11/+9
| | | | | | | | | | | | | | | | | | | | | | Remove an unnecessary workaround introduced in r259975. (NFC) Now that LLVM r259973 allows replacing a temporary type with another temporary we can rely on the original implementation. It is possible for enums to be created as part of their own declcontext. In this case a FwdDecl will be created twice. This doesn't cause a problem because both FwdDecls are entered into the ReplaceMap: finalize() will replace the first FwdDecl with the second and then replace the second with complete type. Thanks to echristo for pointing this out. # Conflicts: # lib/CodeGen/CGDebugInfo.cpp llvm-svn: 261673
* Revert r261634 "Supporting all entities declared in lexical scope in LLVM ↵Hans Wennborg2016-02-233-67/+24
| | | | | | | | debug info." and r261657 r261634 and r261633 seems to have caused PR26715. r261657 depends on the former two. llvm-svn: 261670
* Remove an unnecessary workaround introduced in r259975. (NFC)Adrian Prantl2016-02-231-12/+9
| | | | | | | | | | | | | | | | Now that LLVM r259973 allows replacing a temporary type with another temporary we can rely on the original implementation. It is possible for enums to be created as part of their own declcontext. In this case a FwdDecl will be created twice. This doesn't cause a problem because both FwdDecls are entered into the ReplaceMap: finalize() will replace the first FwdDecl with the second and then replace the second with complete type. Thanks to echristo for pointing this out. llvm-svn: 261657
* Supporting all entities declared in lexical scope in LLVM debug info.Amjad Aboud2016-02-233-14/+60
| | | | | | Differential Revision: http://reviews.llvm.org/D15977 llvm-svn: 261634
* [WebAssembly] Lower va_arg in clang.Dan Gohman2016-02-221-0/+11
| | | | | | | This uses the general emitVoidPtrVAArg lowering logic for everything, since this supports all types, and we don't have any special requirements. llvm-svn: 261557
* [MS ABI] Correctly handle dllimport'd explicit instantiation declaration w/ ↵David Majnemer2016-02-221-0/+3
| | | | | | | | | | | | | | vbases We gave a VBTable dllimport storage class and external linkage while also providing an initializer. An initializer is only valid if the VBTable has available_externally linkage. Fix this by setting the linkage to available_externally in situ while generating the initializer. This fixes PR26686. llvm-svn: 261535
* Add support for Android Vector calling convention for AArch64Nirav Dave2016-02-222-5/+9
| | | | | | | | | | | | | | | | | | | | | | | This modification applies the following Android commit when we have an Android environment. This is the sole non-renderscript in the Android repo commit 9212d4fb30a3ca2f4ee966dd2748c35573d9682c Author: Tim Murray <timmurray@google.com> Date: Fri Aug 15 16:00:15 2014 -0700 Update vector calling convention for AArch64. bug 16846318 Change-Id: I3cfd167758b4bd634d8480ee6ba6bb55d61f82a7 Reviewers: srhines, jyknight Subscribers: mcrosier, aemerson, rengolin, tberghammer, danalbert, srhines Differential Revision: http://reviews.llvm.org/D17448 llvm-svn: 261533
* Class Property: Fix a crash with old ABI when generating metadata in classes.Manman Ren2016-02-211-2/+4
| | | | | | rdar://23891898 llvm-svn: 261466
* Fix handling of vaargs on PPC32 when going from regsave to overflow.Roman Divacky2016-02-201-1/+4
| | | | | | | | | | | | It can happen that when we only have 1 more register left in the regsave area we need to store a value bigger than 1 register and therefore we go to the overflow area. In this case we have to leave the last slot in the regsave area unused and keep using overflow area. Do this by storing a limit value to the used register counter in the overflow block. Issue diagnosed by and solution tested by Mark Millard! llvm-svn: 261422
* [OpenCL] Generate metadata for opencl_unroll_hint attributeAnastasia Stulova2016-02-191-8/+29
| | | | | | | | | | | | | | | Add support for opencl_unroll_hint attribute from OpenCL v2.0 s6.11.5. Reusing most of metadata generation from CGLoopInfo helper class. The code is based on Khronos OpenCL compiler: https://github.com/KhronosGroup/SPIR/tree/spirv-1.0 Patch by Liu Yaxun (Sam)! Differential Revision: http://reviews.llvm.org/D16686 llvm-svn: 261350
* [OPENMP] Improved layout of CGOpenMPRuntime class, NFC.Alexey Bataev2016-02-192-258/+252
| | | | llvm-svn: 261315
* Remove use of builtin comma operator.Richard Trieu2016-02-182-11/+27
| | | | | | Cleanup for upcoming Clang warning -Wcomma. No functionality change intended. llvm-svn: 261271
* Avoid double deletion in Clang driver.Serge Pavlov2016-02-181-21/+8
| | | | | | | | | | | | | | | | Llvm module object is shared between CodeGenerator and BackendConsumer, in both classes it is stored as std::unique_ptr, which is not a good design solution and can cause double deletion error. Usually it does not occur because in BackendConsumer::HandleTranslationUnit the ownership of CodeGenerator over the module is taken away. If however this method is not called, the module is deleted twice and compiler crashes. As the module owned by BackendConsumer is always the same as CodeGenerator has, pointer to llvm module can be removed from BackendGenerator. Differential Revision: http://reviews.llvm.org/D15450 llvm-svn: 261222
* [OPENMP] Fix codegen for lastprivate loop counters.Alexey Bataev2016-02-181-60/+33
| | | | | | | Patch fixes bug with codegen for lastprivate loop counters. Also it may improve performance for lastprivates calculations in some cases. llvm-svn: 261209
* [sanitizer-coverage] implement -fsanitize-coverage=trace-pc. This is similar ↵Kostya Serebryany2016-02-171-0/+1
| | | | | | to trace-bb, but has a different API. We already use the equivalent flag in GCC for Linux kernel fuzzing. We may be able to use this flag with AFL too llvm-svn: 261159
* [CodeGen] Fix an assert in CodeGenFunction::EmitFunctionEpilogAkira Hatanaka2016-02-171-1/+19
| | | | | | | | | | | | | | The assert is triggered because isObjCRetainableType() is called on the canonicalized return type that has been stripped of the typedefs and attributes attached to it. To fix this assert, this commit gets the original return type from CurCodeDecl or BlockInfo and uses it instead of the canoicalized type. rdar://problem/24470031 Differential Revision: http://reviews.llvm.org/D16914 llvm-svn: 261151
* [OPENMP 4.5] Codegen support for data members in 'firstprivate' clause.Alexey Bataev2016-02-171-9/+4
| | | | | | Added codegen for captured data members in non-static member functions. llvm-svn: 261089
* Teach clang to use the ThinLTO pipelineMehdi Amini2016-02-171-1/+2
| | | | | | | | | | | | | Summary: Use the new pipeline implemented in D17115 Reviewers: tejohnson Subscribers: joker.eph, cfe-commits Differential Revision: http://reviews.llvm.org/D17272 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 261045
* [OPENMP] Improved handling of pseudo-captured expressions in OpenMP.Alexey Bataev2016-02-162-86/+111
| | | | | | | | Expressions inside 'schedule'|'dist_schedule' clause must be captured in combined directives to avoid possible crash during codegen. Patch improves handling of such constructs llvm-svn: 260954
* [OPENMP] Remove extra sync barriers for 'firstprivate' clause.Alexey Bataev2016-02-151-20/+26
| | | | | | | Sync barrier will be emitted after generation of firstprivate variables only if one of the firstprivate vars is used in lastprivate clause. llvm-svn: 260877
* [OpenMP] Rename the offload entry points.Samuel Antao2016-02-132-59/+42
| | | | | | | | | | | | | | | Summary: Unlike other outlined regions in OpenMP, offloading entry points have to have be visible (external linkage) for the device side. Using dots in the names of the entries can be therefore problematic for some toolchains, e.g. NVPTX. Also the patch drops the column information in the unique name of the entry points. The parsing of directives ignore unknown tokens, preventing several target regions to be implemented in the same line. Therefore, the line information is sufficient for the name to be unique. Also, the preprocessor printer does not preserve the column information, causing offloading-entry detection issues if the host uses an integrated preprocessor and the target doesn't (or vice versa). Reviewers: hfinkel, arpith-jacob, carlo.bertolli, kkwli0, ABataev Subscribers: cfe-commits, fraggamuffin, caomhin Differential Revision: http://reviews.llvm.org/D17179 llvm-svn: 260837
* RValue refs do not work that way.Benjamin Kramer2016-02-131-1/+2
| | | | llvm-svn: 260823
* Reduce the number of implicit StringRef->std::string conversions by ↵Benjamin Kramer2016-02-133-5/+5
| | | | | | | | threading StringRef through more APIs. No functionality change intended. llvm-svn: 260815
* AMDGPU: Add sin/cos builtinsMatt Arsenault2016-02-131-0/+6
| | | | llvm-svn: 260783
* AMDGPU: Update builtin for intrinsic changeMatt Arsenault2016-02-131-3/+3
| | | | llvm-svn: 260781
* [PR26550] Use a different TBAA root for C++ vs C.Manman Ren2016-02-111-2/+6
| | | | | | | | | | | | | | | | | | | This commit changes the root from "Simple C/C++ TBAA" to "Simple C++ TBAA" for C++. The problem is that the type name in the TBAA nodes is generated differently for C vs C++. If we link an IR file for C with an IR file for C++, since they have the same root and the type names are different, accesses to the two type nodes will be considered no-alias, even though the two type nodes are from the same type in a header file. The fix is to use different roots for C and C++. Types from C will be treated conservatively in respect to types from C++. Follow-up commits will change the C root to "Simple C TBAA" plus some mangling change for C types to make it a little more aggresive. llvm-svn: 260567
* Revert "Revert r260388 "[MS ABI] Never reference dllimport'd vtables""David Majnemer2016-02-112-4/+16
| | | | | | | | | | | | | This reverts commit r260449. We would supress our emission of vftable definitions if we thought another translation unit would provide the definition because we saw an explicit instantiation declaration. This is not the case with dllimport, we want to synthesize a definition of the vftable regardless. This fixes PR26569. llvm-svn: 260548
* [MCU] Fix assertion failure on function returning empty union.Denis Zobnin2016-02-111-1/+5
| | | | | | | | Treat empty struct/union in return type as void for MCU ABI. PR26438. Differential Revision: http://reviews.llvm.org/D16808 llvm-svn: 260510
* [Objective-c] Stop attaching section "datacoal_nt" to global variables.Akira Hatanaka2016-02-111-6/+1
| | | | | | | | | | | | | The current macho linker just copies symbols in section datacoal_nt to section data, so it doesn't really matter whether or not section "datacoal_nt" is attached to the global variable. This is a follow-up to r250370, which made changes in llvm to stop putting functions and data in the *coal* sections. rdar://problem/24528611 llvm-svn: 260496
* [OPENMP] Rename OMPCapturedFieldDecl to OMPCapturedExprDecl, NFC.Alexey Bataev2016-02-112-10/+4
| | | | | | | | OMPCapturedExprDecl allows caopturing not only of fielddecls, but also other expressions. It also allows to simplify codegen for several clauses. llvm-svn: 260492
* [CUDA] Don't crash when trying to printf a non-scalar object.Justin Lebar2016-02-111-0/+7
| | | | | | | | | | | | | | Summary: We can't do the right thing, since there's no right thing to do, but at least we can not crash the compiler. Reviewers: majnemer, rnk Subscribers: cfe-commits, jhen, tra Differential Revision: http://reviews.llvm.org/D17103 llvm-svn: 260479
* Revert r260388 "[MS ABI] Never reference dllimport'd vtables"Hans Wennborg2016-02-101-11/+4
| | | | | | | This caused the compiler to fail with "invalid linkage type for global declaration" (PR26569). llvm-svn: 260449
* Fix some Clang-tidy readability-redundant-control-flow warnings; other minor ↵Eugene Zelenko2016-02-105-66/+88
| | | | | | | | fixes. Differential revision: http://reviews.llvm.org/D17060 llvm-svn: 260414
* Silence some MSVC false positive warnings about integer zexts and falling ↵Reid Kleckner2016-02-101-1/+1
| | | | | | off the end of a covered switch llvm-svn: 260411
* [MS ABI] Never reference dllimport'd vtablesDavid Majnemer2016-02-101-4/+11
| | | | | | | | | | | | | Referencing a dllimported vtable is impossible in a constexpr constructor. It would be friendlier to C++ programmers if we synthesized a copy of the vftable which referenced imported virtual functions. This would let us initialize the object in a way which preserves both the intent to import functionality from another DLL while also making constexpr work. Differential Revision: http://reviews.llvm.org/D17061 llvm-svn: 260388
* [PGO] Fix issue: explicitly defaulted assignop is not profiledXinliang David Li2016-02-091-0/+1
| | | | | | | Differential Revision: http://reviews.llvm.org/D16947 llvm-svn: 260270
* [MS ABI] Cleanup emitVTableDefinitionsDavid Majnemer2016-02-091-6/+6
| | | | | | | Use the VFTable components to determine whether or not we should emit RTTI data instead of duplicating the VFTableBuilder's logic. llvm-svn: 260238
* Fix undefined behavior when compiling in C++14 due to sized operator deleteRichard Smith2016-02-091-2/+1
| | | | | | | being called with the wrong size: convert CGFunctionInfo to use TrailingObjects and ask TrailingObjects to provide a working 'operator delete' for us. llvm-svn: 260181
* [Coverage] Fix crash when handling certain macro expansionsVedant Kumar2016-02-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When handling 'if' statements, we crash if the condition and the consequent branch are spanned by a single macro expansion. The crash occurs because of a sanity 'reset' in popRegions(): if an expansion exactly spans an entire region, we set MostRecentLocation to the start of the expansion (its 'include location'). This ensures we don't handleFileExit() ourselves out of the expansion before we're done processing all of the regions within it. This is tested in test/CoverageMapping/macro-expressions.c. This causes a problem when an expansion spans both the condition and the consequent branch of an 'if' statement. MostRecentLocation is updated to the start of the 'if' statement in popRegions(), so the file for the expansion isn't exited by the time we're done handling the statement. We then crash with 'fatal: File exit not handled before popRegions'. The fix for this is to detect these kinds of expansions, and conservatively update MostRecentLocation to the end of expansion region containing the conditional. I've added tests to make sure we don't have the same problem with other kinds of statements. rdar://problem/23630316 Differential Revision: http://reviews.llvm.org/D16934 llvm-svn: 260129
* Use llvm::TempDIScope instead of manually deleting a temporary MDNode.Adrian Prantl2016-02-081-5/+4
| | | | llvm-svn: 260113
* Re-apply for the 2nd-time r259977 - [OpenMP] Reorganize code to allow ↵Samuel Antao2016-02-084-1/+68
| | | | | | | | specialized code generation for different devices. This was reverted by r260036, but was not the cause of the problem in the buildbot. llvm-svn: 260106
* [OPENMP 4.5] Ccapture/codegen of private non-static data members.Alexey Bataev2016-02-081-0/+1
| | | | | | | OpenMP 4.5 introduces privatization of non-static data members of current class in non-static member functions. To correctly handle such kind of privatization a new (pseudo)declaration VarDecl-based node is added. It allows to reuse an existing code for capturing variables in Lambdas/Block/Captured blocks of code for correct privatization and codegen. llvm-svn: 260077
* [MS ABI] Don't emit RTTI descriptors for dllimport vtablesDavid Majnemer2016-02-071-1/+3
| | | | | | | | A dllimport'd vtable always points one past the RTTI data, this means that the initializer will never end up referencing the data. Our emission is a harmless waste. llvm-svn: 260062
* Revert "Re-apply r259977 - [OpenMP] Reorganize code to allow specialized ↵Renato Golin2016-02-074-68/+1
| | | | | | | | code generation for different devices." This reverts commit r259985, as it still fails one buildbot. llvm-svn: 260036
* Use CodeGenModule::addReplacement() instead of directly accessing ↵Yaron Keren2016-02-071-1/+1
| | | | | | | | Replacements[]. This helps when trying to debug who inserted into Replacements. llvm-svn: 260028
* Fix typo in comment. NFCCraig Topper2016-02-071-1/+1
| | | | llvm-svn: 260020
* Add a missing call to MDNode::deleteTemporary().Adrian Prantl2016-02-061-3/+4
| | | | | | | | Follow-up to r259975. Kudos to the ASAN bots! <rdar://problem/24493203> llvm-svn: 260002
* Re-apply r259977 - [OpenMP] Reorganize code to allow specialized code ↵Samuel Antao2016-02-064-1/+68
| | | | | | | | generation for different devices. This was reverted due to a failure in a buildbot, but it turned out the failure was unrelated. llvm-svn: 259985
* Revert r259977 - [OpenMP] Reorganize code to allow specialized code ↵Samuel Antao2016-02-064-68/+1
| | | | | | | | generation for different devices. It triggered some problem in the configuration related with zlib and exposed in the driver. llvm-svn: 259984
OpenPOWER on IntegriCloud