summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [HIP-Clang] Fat binary should not be produced for non GPU codeAaron Enye Shi2019-04-021-0/+2
| | | | | | | | | | Skip producing the fat binary functions for HIP when no device code is present. Reviewers: yaxunl Differential Review: https://reviews.llvm.org/D60141 llvm-svn: 357520
* [CodeGen] Fix a regression by emitting lambda expressions in EmitLValueErik Pilkington2019-04-021-0/+2
| | | | | | | | | | | This ability was removed in r351487, but it's needed when a lambda appears as an OpaqueValueExpr subexpression of a PseudoObjectExpr. rdar://49030379 Differential revision: https://reviews.llvm.org/D60099 llvm-svn: 357515
* [OPENMP]Add codegen for private vars with allocate clause.Alexey Bataev2019-04-021-6/+2
| | | | | | | Added codegen/test for the privatized variables with the allocate clause. llvm-svn: 357514
* [os_log] Mark os_log_helper `nounwind`Vedant Kumar2019-04-021-0/+1
| | | | | | | | | | | | | Allow the optimizer to remove unnecessary EH cleanups surrounding calls to os_log_helper, to save some code size. As a follow-up, it might be worthwhile to add a BasicNoexcept exception spec to os_log_helper, and to then teach CGCall to emit direct calls for callees which can't throw. This could save some compile-time. Differential Revision: https://reviews.llvm.org/D60108 llvm-svn: 357501
* [OPENMP]Fix mapping of the pointers captured by reference.Alexey Bataev2019-04-021-3/+12
| | | | | | | | If the pointer is captured by reference, it must be mapped as _PTR_AND_OBJ kind of mapping to correctly translate the pointer address on the device. llvm-svn: 357488
* [CodeGen] Generate follow-up metadata for loops with more than one ↵Michael Kruse2019-04-012-94/+530
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | transformation. Before this patch, CGLoop would dump all transformations for a loop into a single LoopID without encoding any order in which to apply them. rL348944 added the possibility to encode a transformation order using followup-attributes. When a loop has more than one transformation, use the follow-up attribute define the order in which they are applied. The emitted order is the defacto order as defined by the current LLVM pass pipeline, which is: LoopFullUnrollPass LoopDistributePass LoopVectorizePass LoopUnrollAndJamPass LoopUnrollPass MachinePipeliner This patch should therefore not change the assembly output, assuming that all explicit transformations can be applied, and no implicit transformations in-between. In the former case, WarnMissedTransformationsPass should emit a warning (except for MachinePipeliner which is not implemented yet). The latter could be avoided by adding 'llvm.loop.disable_nonforced' attributes. Because LoopUnrollAndJamPass processes a loop nest, generation of the MDNode is delayed to after the inner loop metadata have been processed. A temporary LoopID is therefore used to annotate instructions and RAUW'ed by the actual LoopID later. Differential Revision: https://reviews.llvm.org/D57978 llvm-svn: 357415
* [gnustep-objc] Make the GNUstep v2 ABI work for Windows DLLs.David Chisnall2019-03-311-29/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Based on a patch by Dustin Howett, modified to not change the ABI for ELF platforms. Use more Windows-like section names. This also makes things more readable by PE/COFF debug tools that assume sections fit in the first header. With these changes in, it is now possible to build a working WinObjC with clang and the WinObjC version of GNUstep libobjc (upstream GNUstep libobjc + a work around for incremental linking, which can be removed once LINK.EXE gains a feature to opt sections out of receiving extra padding during an incremental link). Patch by Dustin Howett! Reviewers: DHowett-MSFT Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58724 llvm-svn: 357364
* COMDAT-fold block descriptors.David Chisnall2019-03-311-0/+2
| | | | | | | | | | | Without this change, linking multiple objects containing block descriptors together on Windows will generate duplicate symbol errors. Patch by Dustin Howett! Differential Revision: https://reviews.llvm.org/D58807 llvm-svn: 357363
* [objc-gnustep] Use .init_array not .ctors when requested.David Chisnall2019-03-311-1/+6
| | | | | | | This doesn't make a difference most of the time but FreeBSD/ARM doesn't run anything in the .ctors array. llvm-svn: 357362
* Adds `-ftime-trace` option to clang that produces Chrome `chrome://tracing` ↵Anton Afanasyev2019-03-302-0/+8
| | | | | | | | | | | | | | compatible JSON profiling output dumps. This change adds hierarchical "time trace" profiling blocks that can be visualized in Chrome, in a "flame chart" style. Each profiling block can have a "detail" string that for example indicates the file being processed, template name being instantiated, function being optimized etc. This is taken from GitHub PR: https://github.com/aras-p/llvm-project-20170507/pull/2 Patch by Aras Pranckevičius. Differential Revision: https://reviews.llvm.org/D58675 llvm-svn: 357340
* [CodeGen][ObjC] Adjust the addresses passed to calls to synthesizedAkira Hatanaka2019-03-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | copy/move constructor/assignment operator functions for non-trivial C structs. This commit fixes a bug where the offset of struct fields weren't being taken into account when computing the addresses passed to calls to the special functions. For example, the copy constructor for S1 (__copy_constructor_8_8_s0_s8) would pass the start addresses of the destination and source structs to the call to S0's copy constructor (_copy_constructor_8_8_s0) without adding the offset of field f1 to the addresses. typedef struct { id f0; S0 f1; } S1; void test(S1 s1) { S1 t = s1; } rdar://problem/49400610 llvm-svn: 357229
* Fix typos and formatting. NFC.Akira Hatanaka2019-03-291-58/+54
| | | | llvm-svn: 357228
* [MS] Make __iso_volatile_* available on all targetsReid Kleckner2019-03-282-54/+41
| | | | | | | | | | | Future versions of MSVC make these intrinsics available on x86 & x64, according to: http://lists.llvm.org/pipermail/cfe-dev/2019-March/061711.html The purpose of these builtins is to emit plain, non-atomic, volatile stores when /volatile:ms (-cc1 -fms-volatile) is enabled. llvm-svn: 357220
* Make helper functions static. NFC.Benjamin Kramer2019-03-281-3/+4
| | | | llvm-svn: 357187
* [CodeGen] Add additional mangling for struct members of non trivial structsShoaib Meenai2019-03-281-2/+3
| | | | | | | | | | | | | In https://bugs.llvm.org/show_bug.cgi?id=41206 we observe bad codegen when embedding a non-trivial C struct within a C struct. This is due to the fact that name mangling for non-trivial structs marks the two structs as identical. This diff contains a fix for this issue. Patch by Dan Zimmerman <daniel.zimmerman@me.com>. Differential Revision: https://reviews.llvm.org/D59873 llvm-svn: 357184
* [OPENMP]Initial support for 'allocate' clause.Alexey Bataev2019-03-271-1/+1
| | | | | | Added parsing/sema analysis of the allocate clause. llvm-svn: 357068
* [CodeGen] Delete never used LValueAlignFangrui Song2019-03-261-2/+0
| | | | | | It was added by rC176658 but never used since then. llvm-svn: 357001
* AMDGPU: Add support for cross address space synchronization scopes (clang)Konstantin Zhuravlyov2019-03-253-13/+33
| | | | | | Differential Revision: https://reviews.llvm.org/D59494 llvm-svn: 356947
* Fix unused variable warning. NFCI.Simon Pilgrim2019-03-231-1/+1
| | | | llvm-svn: 356839
* IRGen: Remove StructorType; thread GlobalDecl through more code. NFCI.Peter Collingbourne2019-03-2213-229/+113
| | | | | | | | This should make it easier to add more structor variants. Differential Revision: https://reviews.llvm.org/D59724 llvm-svn: 356822
* [ARM] Fix bug 39982 - pcs("aapcs-vfp") is not consistentCarey Williams2019-03-221-16/+36
| | | | | | | | | | Correctly handle homogeneous aggregates when a function's ABI is specified via the pcs attribute. Bug: https://bugs.llvm.org/show_bug.cgi?id=39982 Differential Revision: https://reviews.llvm.org/D59094 llvm-svn: 356776
* [AArch64] Split the neon.addp intrinsic into integer and fp variants.Amara Emerson2019-03-211-0/+7
| | | | | | | | | | | | | | | | | | | This is the result of discussions on the list about how to deal with intrinsics which require codegen to disambiguate them via only the integer/fp overloads. It causes problems for GlobalISel as some of that information is lost during translation, while with other operations like IR instructions the information is encoded into the instruction opcode. This patch changes clang to emit the new faddp intrinsic if the vector operands to the builtin have FP element types. LLVM IR AutoUpgrade has been taught to upgrade existing calls to aarch64.neon.addp with fp vector arguments, and we remove the workarounds introduced for GlobalISel in r355865. This is a more permanent solution to PR40968. Differential Revision: https://reviews.llvm.org/D59655 llvm-svn: 356722
* [OPENMP]Fix a warning about unused variable, NFC.Alexey Bataev2019-03-211-0/+1
| | | | llvm-svn: 356715
* [OPENMP] Simplify codegen for allocate directive on local variables.Alexey Bataev2019-03-212-45/+65
| | | | | | | Simplified codegen for the allocate directive for local variables, initial implementation of the codegen for NVPTX target. llvm-svn: 356710
* [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValueAkira Hatanaka2019-03-213-11/+28
| | | | | | | | | | | | | with notail on x86-64. On x86-64, the epilogue code inserted before the tail jump blocks the autoreleased return optimization. rdar://problem/38675807 Differential Revision: https://reviews.llvm.org/D59656 llvm-svn: 356705
* [OPENMP]Codegen support for allocate directive on global variables.Alexey Bataev2019-03-215-0/+67
| | | | | | | | | For the global variables the allocate directive must specify only the predefined allocator. This allocator must be translated into the correct form of the address space for the targets that support different address spaces. llvm-svn: 356702
* [OpenCL] Generate 'unroll.enable' metadata for ↵Andrew Savonichev2019-03-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __attribute__((opencl_unroll_hint)) Summary: [OpenCL] Generate 'unroll.enable' metadata for __attribute__((opencl_unroll_hint)) For both !{!"llvm.loop.unroll.enable"} and !{!"llvm.loop.unroll.full"} the unroller will try to fully unroll a loop unless the trip count is not known at compile time. In that case for '.full' metadata no unrolling will be processed, while for '.enable' the loop will be partially unrolled with a heuristically chosen unroll factor. See: docs/LanguageExtensions.rst From https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/attributes-loopUnroll.html __attribute__((opencl_unroll_hint)) for (int i=0; i<2; i++) { ... } In the example above, the compiler will determine how much to unroll the loop. Before the patch for __attribute__((opencl_unroll_hint)) was generated metadata !{!"llvm.loop.unroll.full"}, which limits ability of loop unroller to decide, how much to unroll the loop. Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: zzheng, dmgreen, jdoerfert, cfe-commits, asavonic, AlexeySotkin Tags: #clang Differential Revision: https://reviews.llvm.org/D59493 llvm-svn: 356571
* Add a spelling of pass_object_size that uses __builtin_dynamic_object_sizeErik Pilkington2019-03-191-1/+1
| | | | | | | | | | | The attribute pass_dynamic_object_size(n) behaves exactly like pass_object_size(n), but instead of evaluating __builtin_object_size on calls, it evaluates __builtin_dynamic_object_size, which has the potential to produce runtime code when the object size can't be determined statically. Differential revision: https://reviews.llvm.org/D58757 llvm-svn: 356515
* Fix unused variable warning. NFCI.Simon Pilgrim2019-03-191-1/+1
| | | | llvm-svn: 356497
* [OPENMP]Remove unused parameter, NFC.Alexey Bataev2019-03-195-14/+12
| | | | | | | Parameter CodeGenModule &CGM is not required for CGOpenMPRuntime member functions, since class holds the reference to the CGM. llvm-svn: 356480
* [OPENMP] Codegen for local variables with the allocate pragma.Alexey Bataev2019-03-193-0/+106
| | | | | | | | Added initial codegen for the local variables with the #pragma omp allocate directive. Instead of allocating the variables on the stack, __kmpc_alloc|__kmpc_free functions are used for memory (de-)allocation. llvm-svn: 356472
* Refactor cast<>'s in if conditionals, which can only assert on failure.Don Hinton2019-03-192-26/+15
| | | | | | | | | | | | | | | | | Summary: This patch refactors several instances of cast<> used in if conditionals. Since cast<> asserts on failure, the else branch can never be taken. In some cases, the fix is to replace cast<> with dyn_cast<>. While others required the removal of the conditional and some minor refactoring. A discussion can be seen here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190318/265044.html Differential Revision: https://reviews.llvm.org/D59529 llvm-svn: 356441
* [MS] Skip vbase construction in abstract class ctorsReid Kleckner2019-03-181-13/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As background, when constructing a complete object, virtual bases are constructed first. If an exception is thrown later in the ctor, those virtual bases are destroyed, so sema marks the relevant constructors and destructors of virtual bases as referenced. If necessary, they are emitted. However, an abstract class can never be used to construct a complete object. In the Itanium C++ ABI, this works out nicely, because we never end up emitting the "complete" constructor variant, only the "base" constructor variant, which can be called by constructors of derived classes. Clang's Sema::MarkBaseAndMemberDestructorsReferenced is aware of this optimization, and it does not mark ctors and dtors of virtual bases referenced when the constructor of an abstract class is emitted. In the Microsoft ABI, there are no complete/base variants, so before this change, the constructor of an abstract class could reference ctors and dtors of a virtual base without marking them referenced. This could lead to unresolved symbol errors at link time, as reported in PR41065. The fix is to implement the same optimization as Sema: If the class is abstract, don't bother initializing its virtual bases. The "is this class the most derived class" check in the constructor will never pass, and the virtual base constructor calls are always dead. Skip them. I think Richard noticed this missed optimization back in 2016 when he was implementing inheriting constructors. I wasn't able to find any bugs or email about it, though. Fixes PR41065 llvm-svn: 356425
* [OPENMP] Set scheduling for doacross loops as schedule, 1.Alexey Bataev2019-03-182-1/+19
| | | | | | | The default scheduling for doacross loops is changed from static to static, 1. llvm-svn: 356388
* CodeGen: Preserve packed attribute in constStructWithPadding.Peter Collingbourne2019-03-161-1/+1
| | | | | | | | Otherwise the object may have an incorrect size due to tail padding. Differential Revision: https://reviews.llvm.org/D59446 llvm-svn: 356328
* [WebAssembly] Use rethrow intrinsic in the rethrow blockHeejin Ahn2019-03-162-3/+5
| | | | | | | | | | | | | | | | | | | | | | Summary: Because in wasm we merge all catch clauses into one big catchpad, in case none of the types in catch handlers matches after we test against each of them, we should unwind to the next EH enclosing scope. For this, we should NOT use a call to `__cxa_rethrow` but rather a call to our own rethrow intrinsic, because what we're trying to do here is just to transfer the control flow into the next enclosing EH pad (or the caller). Calls to `__cxa_rethrow` should only be used after a call to `__cxa_begin_catch`. Reviewers: dschuff Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59353 llvm-svn: 356317
* [OPENMP]Fix crash for the ordered(n) clause.Alexey Bataev2019-03-141-2/+3
| | | | | | | | If the doacross lop construct is used and the loop counter is declare outside of the loop, the compiler might crash trying to get the address of the loop counter. Patch fixes this problem. llvm-svn: 356198
* [CodeGen] Consider tied operands when adjusting inline asm operands.Eli Friedman2019-03-141-2/+8
| | | | | | | | | | | | | The constraint "0" in the following asm did not consider the its relationship with "=y" when try to replace the type of the operands. asm ("nop" : "=y"(Mu8_1 ) : "0"(Mu8_0 )); Patch by Xiang Zhang. Differential Revision: https://reviews.llvm.org/D56990 llvm-svn: 356196
* [CodeGen][ObjC] Remove the leading 'l' from symbols for protocolAkira Hatanaka2019-03-141-3/+3
| | | | | | | | | | | | | metadata and protocol list The leading 'l' tells ld64 to remove the symbol name, which can make debugging difficult. rdar://problem/47256637 Differential Revision: https://reviews.llvm.org/D59234 llvm-svn: 356156
* Revert "Add a new attribute, fortify_stdlib"Erik Pilkington2019-03-132-88/+0
| | | | | | | | | | This reverts commit r353765. After talking with our c stdlib folks, we decided to use the existing pass_object_size attribute to implement _FORTIFY_SOURCE wrappers, like Bionic does (I didn't realize that pass_object_size could be used for this purpose). Sorry for the flip/flop, and thanks to James Y. Knight for pointing this out to me. llvm-svn: 356103
* [OPENMP]Fix PR37283: Assertion failure on openmp task with by referenceAlexey Bataev2019-03-131-1/+1
| | | | | | | | | | array. If the firstprivate variable is a reference, we may incorrectly classify the kind of the private copy. Use the type of the private copy instead of the original shared variable. llvm-svn: 356098
* [OPENMP][NVPTX]Fix PR40893: Size doesn't match forAlexey Bataev2019-03-131-2/+8
| | | | | | | | | | | '_openmp_teams_reductions_buffer_$_. nvlink does not handle weak linkage correctly, same symbols with the different sizes are reported as erroneous though the largest size must be chosen instead. Patch fixes this problem by using Internal linkage instead of the Common. llvm-svn: 356072
* Add XCOFF triple object format type for AIXJason Liu2019-03-122-0/+8
| | | | | | | | | This patch adds an XCOFF triple object format type into LLVM. This XCOFF triple object file type will be used later by object file and assembly generation for the AIX platform. Differential Revision: https://reviews.llvm.org/D58930 llvm-svn: 355989
* Reland "[Remarks] Add -foptimization-record-passes to filter remark emission"Francis Visoiu Mistrih2019-03-122-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently we have -Rpass for filtering the remarks that are displayed as diagnostics, but when using -fsave-optimization-record, there is no way to filter the remarks while generating them. This adds support for filtering remarks by passes using a regex. Ex: `clang -fsave-optimization-record -foptimization-record-passes=inline` will only emit the remarks coming from the pass `inline`. This adds: * `-fsave-optimization-record` to the driver * `-opt-record-passes` to cc1 * `-lto-pass-remarks-filter` to the LTOCodeGenerator * `--opt-remarks-passes` to lld * `-pass-remarks-filter` to llc, opt, llvm-lto, llvm-lto2 * `-opt-remarks-passes` to gold-plugin Differential Revision: https://reviews.llvm.org/D59268 Original llvm-svn: 355964 llvm-svn: 355984
* Revert "[Remarks] Add -foptimization-record-passes to filter remark emission"Francis Visoiu Mistrih2019-03-122-8/+0
| | | | | | This reverts commit 20fff32b7d1f1a1bd417b22aa9f26ededd97a3e5. llvm-svn: 355976
* [Remarks] Add -foptimization-record-passes to filter remark emissionFrancis Visoiu Mistrih2019-03-122-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Currently we have -Rpass for filtering the remarks that are displayed as diagnostics, but when using -fsave-optimization-record, there is no way to filter the remarks while generating them. This adds support for filtering remarks by passes using a regex. Ex: `clang -fsave-optimization-record -foptimization-record-passes=inline` will only emit the remarks coming from the pass `inline`. This adds: * `-fsave-optimization-record` to the driver * `-opt-record-passes` to cc1 * `-lto-pass-remarks-filter` to the LTOCodeGenerator * `--opt-remarks-passes` to lld * `-pass-remarks-filter` to llc, opt, llvm-lto, llvm-lto2 * `-opt-remarks-passes` to gold-plugin Differential Revision: https://reviews.llvm.org/D59268 llvm-svn: 355964
* [OPENMP]Allow to redefine entry for the variables definitions.Alexey Bataev2019-03-121-3/+18
| | | | | | | | | | | If the variable was declared and marked as declare target, a new offload entry with size 0 is created. But if later a definition is created and marked as declare target, this definition is not added to the entry set and the definition remains not mapped to the target. Patch fixes this problem allowing to redefine the size and linkage for previously registered declaration. llvm-svn: 355960
* [OPENMP 5.0]Initial support for 'allocator' clause.Alexey Bataev2019-03-121-0/+1
| | | | | | | Added parsing/sema analysis/serialization/deserialization for the 'allocator' clause of the 'allocate' directive. llvm-svn: 355952
* Remove esan.Nico Weber2019-03-111-20/+0
| | | | | | | | | | | It hasn't seen active development in years, and it hasn't reached a state where it was useful. Remove the code until someone is interested in working on it again. Differential Revision: https://reviews.llvm.org/D59133 llvm-svn: 355862
* [OPENMP]Remove debug service variable.Alexey Bataev2019-03-081-14/+0
| | | | | | Removed not required service variable for the debug info. llvm-svn: 355729
OpenPOWER on IntegriCloud