summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Support for the mno-stack-arg-probe flagHans Wennborg2018-02-231-10/+9
| | | | | | | | | | | | Adds support for this flag. There is also another piece for llvm (separate review). More info: https://bugs.llvm.org/show_bug.cgi?id=36221 By Ruslan Nikolaev! Differential Revision: https://reviews.llvm.org/D43108 llvm-svn: 325901
* [mips] Revert r325872Stefan Maksimovic2018-02-231-8/+0
| | | | | | | There are still outstanding issues with byVal arguments that prevent this from being committed. Revert for now. llvm-svn: 325899
* [mips] Reland r310704Stefan Maksimovic2018-02-231-0/+8
| | | | | | | | Recommit this change which was previously reverted for the 5.0.0 release since the failures identified were dealt with in r325782. llvm-svn: 325872
* Simplify setting dso_local. NFC.Rafael Espindola2018-02-233-12/+12
| | | | | | | | | | | The value of dso_local can be computed from just IR properties and global information (object file type, command line options, etc). With this patch we no longer pass in the Decl. It was almost unused and making it fully unused guarantees that dso_local is consistent with the rest of the IR. llvm-svn: 325846
* [OpenMP] Limit reduction support for pragma 'distribute' when combined with ↵Carlo Bertolli2018-02-221-19/+23
| | | | | | | | | | | pragma 'simd' Differential Revision: https://reviews.llvm.org/D43513 This is a bug fix that removes the emission of reduction support for pragma 'distribute' when found alone or in combinations without simd. Pragma 'distribute' does not have a reduction clause, but when combined with pragma 'simd' we need to emit the support for simd's reduction clause as part of code generation for distribute. This guard is similar to the one used for reduction support earlier in the same code gen function. llvm-svn: 325822
* [OPENMP] Require valid SourceLocation in function call, NFC.Alexey Bataev2018-02-222-8/+7
| | | | | | | Removed default empty SourceLocation argument from `emitCall` function and require valid location. llvm-svn: 325812
* [OpenCL] Add '-cl-uniform-work-group-size' compile optionAlexey Sotkin2018-02-221-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: OpenCL 2.0 specification defines '-cl-uniform-work-group-size' option, which requires that the global work-size be a multiple of the work-group size specified to clEnqueueNDRangeKernel and allows optimizations that are made possible by this restriction. The patch introduces the support of this option. To keep information about whether an OpenCL kernel has uniform work group size or not, clang generates 'uniform-work-group-size' function attribute for every kernel: - "uniform-work-group-size"="true" for OpenCL 1.2 and lower, - "uniform-work-group-size"="true" for OpenCL 2.0 and higher if '-cl-uniform-work-group-size' option was specified, - "uniform-work-group-size"="false" for OpenCL 2.0 and higher if no '-cl-uniform-work-group-size' options was specified. If the function is not an OpenCL kernel, 'uniform-work-group-size' attribute isn't generated. Patch by: krisb Reviewers: yaxunl, Anastasia, b-sumner Reviewed By: yaxunl, Anastasia Subscribers: nhaehnle, yaxunl, Anastasia, cfe-commits Differential Revision: https://reviews.llvm.org/D43570 llvm-svn: 325771
* CodeGen: handle blocks correctly when inalloca'edSaleem Abdulrasool2018-02-211-2/+5
| | | | | | | | | | When using blocks with C++ on Windows x86, it is possible to have the block literal be pushed into the inalloca'ed parameters. Teach IRGen to handle the case properly by extracting the block literal from the inalloca parameter. This fixes the use of blocks with C++ on Windows x86. llvm-svn: 325724
* [CodeGen] Fix generation of TBAA tags for may-alias accessesIvan A. Kosarev2018-02-203-7/+20
| | | | | | | | | | | This patch fixes creating TBAA access descriptors for may_alias-marked access types. Currently, for such types we generate ordinary descriptors with char as its access type. The patch changes this to produce proper may-alias descriptors. Differential Revision: https://reviews.llvm.org/D42366 llvm-svn: 325575
* [CodeGen] Initialize large arrays by copying from a globalIvan A. Kosarev2018-02-191-6/+30
| | | | | | | | | | | | | | Currently, clang compiles explicit initializers for array elements into series of store instructions. For large arrays of built-in types this results in bloated output code and significant amount of time spent on the instruction selection phase. This patch fixes the issue by initializing such arrays with global constants that store the binary image of the initializer. Differential Revision: https://reviews.llvm.org/D43181 llvm-svn: 325478
* [ThinLTO] Allow indexing to request backend to ignore the moduleVitaly Buka2018-02-161-5/+17
| | | | | | | | | | | | | | | | | | Summary: Gold plugin does not add pass to ThinLTO modules without useful symbols. In this case ThinLTO can't create corresponding index file and some features, like CFI, cannot be processes by backed correctly without index. Given that we don't need the backed output we can request it to avoid processing the module. This is implemented by this patch using new "SkipModuleByDistributedBackend" flag. Reviewers: pcc, tejohnson Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D42995 llvm-svn: 325411
* [ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is setVitaly Buka2018-02-162-10/+25
| | | | | | | | | | | | | | | | | Summary: ThinLTO compilation may decide not to split module and keep at as regular LTO. In this can this module already processed during indexing and already a part of merged object file. So here we can just skip it. Reviewers: pcc, tejohnson Reviewed By: tejohnson Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D42680 llvm-svn: 325410
* [Coverage] Handle break/continue outside of loop bodiesVedant Kumar2018-02-161-8/+16
| | | | | | | | | Teach the coverage mapping logic to handle break or continue statements within for loop increments. Fixes llvm.org/PR36406. llvm-svn: 325319
* [OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.Alexey Bataev2018-02-151-0/+2
| | | | | | | | | Codegen for ordered with doacross construct might produce incorrect code because of missing cleanup scope for the construct. Without this scope the final runtime function call could be emitted in the wrong order that leads to incorrect codegen. llvm-svn: 325304
* [OpenCL] Fix __enqueue_block for block with capturesYaxun Liu2018-02-154-39/+56
| | | | | | | | | | | | | | | | | | | | | | | | | The following test case causes issue with codegen of __enqueue_block void (^block)(void) = ^{ callee(id, out); }; enqueue_kernel(queue, 0, ndrange, block); Clang first does codegen for block expression in the first line and deletes its block info. Clang then tries to do codegen for the same block expression again for the second line, and fails because the block info is gone. The fix is to do normal codegen for both lines. Introduce an API to OpenCL runtime to record llvm block invoke function and llvm block literal emitted for each AST block expression, and use the recorded information for generating the wrapper kernel. The EmitBlockLiteral APIs are cleaned up to minimize changes to the normal codegen of blocks. Another minor issue is that some clean up AST expression is generated for block with captures, which can be stripped by IgnoreImplicit. Differential Revision: https://reviews.llvm.org/D43240 llvm-svn: 325264
* Update for llvm change. NFC.Rafael Espindola2018-02-141-2/+2
| | | | llvm-svn: 325156
* Implement function attribute artificialErich Keane2018-02-141-1/+1
| | | | | | | | | | | | Added support in clang for GCC function attribute 'artificial'. This attribute is used to control stepping behavior of debugger with respect to inline functions. Patch By: Elizabeth Andrews (eandrews) Differential Revision: https://reviews.llvm.org/D43259 llvm-svn: 325081
* [DebugInfo] Avoid name conflict of generated VLA expression variable.Sander de Smalen2018-02-131-2/+3
| | | | | | | | | | | | | | | | | Summary: This patch also adds the 'DW_AT_artificial' flag to the generated variable. Addresses the issues mentioned in http://llvm.org/PR30553. Reviewers: CarlosAlbertoEnciso, probinson, aprantl Reviewed By: aprantl Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D43189 llvm-svn: 324988
* [X86] Reverse the operand order of the implementation of the kunpack builtins.Craig Topper2018-02-121-1/+2
| | | | | | | | The second operand needs to be in the lower bits of the concatenation. This matches llvm 5.0, gcc, and icc behavior. Fixes PR36360. llvm-svn: 324954
* [AArch64] Fixes for ARMv8.2-A FP16 scalar intrinsic - clang portionAbderrazek Zaafrani2018-02-121-17/+98
| | | | | | https://reviews.llvm.org/D42993 llvm-svn: 324940
* [DebugInfo] Update Checksum handling in CGDebugInfoScott Linder2018-02-122-12/+16
| | | | | | Update to match new DIFile API. llvm-svn: 324929
* Make attribute-target on a Definition-after-use update the LLVM attributesErich Keane2018-02-123-40/+59
| | | | | | | | | | | | | | | As reported here: https://bugs.llvm.org/show_bug.cgi?id=36301 The issue is that the 'use' causes the plain declaration to emit the attributes to LLVM-IR. However, if the definition added it later, these would silently disappear. This commit extracts that logic to its own function in CodeGenModule, and has the attribute-applications done during 'definition' update the attributes properly. Differential Revision: https://reviews.llvm.org/D43095 llvm-svn: 324907
* Re-commit r324490: [DebugInfo] Improvements to representation of enumeration ↵Momchil Velikov2018-02-121-5/+7
| | | | | | | | types (PR36168) Differential revision: https://reviews.llvm.org/D42736 llvm-svn: 324900
* ASan+operator new[]: Add an option for more thorough operator new[] cookie ↵Filipe Cabecinhas2018-02-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | poisoning Summary: Right now clang is skipping array cookie poisoning for any operator new[] which is not part of the set of replaceable global allocation functions. This commit adds a flag to tell clang to poison all operator new[] cookies. A previous review was poisoning all array cookies unconditionally, but there is an edge case which would stop working under ASan (a custom operator new[] saves whatever pointer it returned, and then accesses it). This newer revision adds a command line argument to toggle this feature. Original revision: https://reviews.llvm.org/D41301 Compiler-rt test revision with an explanation of the edge case: https://reviews.llvm.org/D41664 Reviewers: rjmccall, kcc, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43013 llvm-svn: 324884
* [X86] Change the signature of the AVX512 packed fp compare intrinsics to ↵Craig Topper2018-02-101-17/+64
| | | | | | | | | | | | | | | | return vXi1 mask. Make bitcasts to scalar explicit in IR Summary: This is the clang equivalent of r324827 Reviewers: zvi, delena, RKSimon, spatel Reviewed By: RKSimon Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43143 llvm-svn: 324828
* [CodeGen] Use the zero initializer instead of storing an all zero ↵Matt Davis2018-02-091-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | representation. Summary: This change avoids the overhead of storing, and later crawling, an initializer list of all zeros for arrays. When LLVM visits this (llvm/IR/Constants.cpp) ConstantArray::getImpl() it will scan the list looking for an array of all zero. We can avoid the store, and short-cut the scan, by detecting all zeros when clang builds-up the initialization representation. This was brought to my attention when investigating PR36030 Reviewers: majnemer, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42549 llvm-svn: 324776
* [WinEH] Put funclet bundles on inline asm callsReid Kleckner2018-02-093-16/+19
| | | | | | | | | | | | | | | | Summary: Fixes PR36247, which is where WinEHPrepare replaces inline asm in funclets with unreachable. Make getBundlesForFunclet return by value to simplify some call sites. Reviewers: smeenai, majnemer Subscribers: eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D43033 llvm-svn: 324689
* [X86] Replace kortest intrinsics with native IR.Craig Topper2018-02-081-0/+12
| | | | llvm-svn: 324647
* Fix improper indentation issue in CodeGenModule [NFC]Erich Keane2018-02-081-2/+2
| | | | llvm-svn: 324644
* Fix crash on array initializer with non-0 alloca addrspaceMatt Arsenault2018-02-081-1/+2
| | | | llvm-svn: 324641
* Fix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.Alexander Ivchenko2018-02-081-1/+11
| | | | | | | | | | | | | | | | Summary: This patch is a fix for following issue: https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by front end lowering C calling conventions without taking into account calling conventions enforced by attribute. In this case win64cc was no correctly lowered on targets other than Windows. Reviewed By: rnk (Reid Kleckner) Differential Revision: https://reviews.llvm.org/D43016 Author: belickim <mateusz.belicki@intel.com> llvm-svn: 324594
* Don't try to use copy relocations with tls variables.Rafael Espindola2018-02-071-3/+4
| | | | | | Should fix the lldb bot. llvm-svn: 324539
* Recommit r324107 again.Rafael Espindola2018-02-076-11/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | The difference from the previous try is that we no longer directly access function declarations from position independent executables. It should work, but currently doesn't with some linkers. It now includes a fix to not mark available_externally definitions as dso_local. Original message: Start setting dso_local in clang. This starts adding dso_local to clang. The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go away. My objective for now is to move enough of it to clang to remove the need for the TargetMachine one to handle PIE copy relocations and -fno-plt. With that it should then be easy to implement a -fno-copy-reloc in clang. This patch just adds the cases where we assume a symbol to be local based on the file being compiled for an executable or a shared library. llvm-svn: 324535
* Revert [DebugInfo] Improvements to representation of enumeration types ↵Momchil Velikov2018-02-071-7/+5
| | | | | | | | (PR36168)" Revert due to breaking buildbots (LLDB tests) llvm-svn: 324508
* Revert "Recommit r324107."Rafael Espindola2018-02-076-76/+11
| | | | | | | | | | | | | | This reverts commit r324500. The bots found two failures: ThreadSanitizer-x86_64 :: Linux/pie_no_aslr.cc ThreadSanitizer-x86_64 :: pie_test.cc when using gold. The issue is a limitation in gold when building pie binaries. I will investigate how to work around it. llvm-svn: 324505
* Recommit r324107.Rafael Espindola2018-02-076-11/+76
| | | | | | | | | | | | | | | | | | | | | | | It now includes a fix to not mark available_externally definitions as dso_local. Original message: Start setting dso_local in clang. This starts adding dso_local to clang. The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go away. My objective for now is to move enough of it to clang to remove the need for the TargetMachine one to handle PIE copy relocations and -fno-plt. With that it should then be easy to implement a -fno-copy-reloc in clang. This patch just adds the cases where we assume a symbol to be local based on the file being compiled for an executable or a shared library. llvm-svn: 324500
* Don't pass ForDefinition_t in places it is redundant.Rafael Espindola2018-02-078-84/+56
| | | | | | | | | | | | | | I found this while looking at the ppc failures caused by the dso_local change. The issue was that the patch would produce the wrong answer for available_externally. Having ForDefinition_t available in places where the code can just check the linkage is a bit of a foot gun. This patch removes the ForDefiniton_t argument in places where the linkage is already know. llvm-svn: 324499
* [DebugInfo] Improvements to representation of enumeration types (PR36168)Momchil Velikov2018-02-071-5/+7
| | | | | | | | | | | | | | | This patch: * fixes an incorrect sign-extension of unsigned values, when emitting debug info metadata for enumerators * the enumerators metadata is created with a flag, which determines interpretation of the value bits (signed or unsigned) * the enumerations metadata contains the underlying integer type and a flag, indicating whether this is a C++ "fixed enum" Differential Revision: https://reviews.llvm.org/D42736 llvm-svn: 324490
* Support `#pragma comment(lib, "name")` in the frontend for ELFSaleem Abdulrasool2018-02-072-1/+13
| | | | | | | | | | | | | This adds the frontend support required to support the use of the comment pragma to enable auto linking on ELFish targets. This is a generic ELF extension supported by LLVM. We need to change the handling for the "dependentlib" in order to accommodate the previously discussed encoding for the dependent library descriptor. Without the custom handling of the PCK_Lib directive, the -l prefixed option would be encoded into the resulting object (which is treated as a frontend error). llvm-svn: 324438
* Pass around function pointers as CGCallees, not bare llvm::Value*s.John McCall2018-02-065-58/+77
| | | | | | | The intention here is to make it easy to write frontend-assisted CFI systems by propagating extra information in the CGCallee. llvm-svn: 324377
* IRGen: Move vtable load after argument evaluation.Peter Collingbourne2018-02-056-78/+112
| | | | | | | | | | | | | | This change reduces the live range of the loaded function pointer, resulting in a slight code size decrease (~10KB in clang), and also improves the security of CFI for virtual calls by making it less likely that the function pointer will be spilled, and ensuring that it is not spilled across a function call boundary. Fixes PR35353. Differential Revision: https://reviews.llvm.org/D42725 llvm-svn: 324286
* Add support for attribute 'trivial_abi'.Akira Hatanaka2018-02-054-31/+45
| | | | | | | | | | | | | | | | | | | | | | | | | The 'trivial_abi' attribute can be applied to a C++ class, struct, or union. It makes special functions of the annotated class (the destructor and copy/move constructors) to be trivial for the purpose of calls and, as a result, enables the annotated class or containing classes to be passed or returned using the C ABI for the underlying type. When a type that is considered trivial for the purpose of calls despite having a non-trivial destructor (which happens only when the class type or one of its subobjects is a 'trivial_abi' class) is passed to a function, the callee is responsible for destroying the object. For more background, see the discussions that took place on the mailing list: http://lists.llvm.org/pipermail/cfe-dev/2017-November/055955.html http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180101/thread.html#214043 rdar://problem/35204524 Differential Revision: https://reviews.llvm.org/D41039 llvm-svn: 324269
* Recommit rL323952: [DebugInfo] Enable debug information for C99 VLA types.Sander de Smalen2018-02-0311-71/+180
| | | | | | Fixed build issue when building with g++-4.8 (specialization after instantiation). llvm-svn: 324173
* Emit label names according to -discard-value-names.Eric Fiselier2018-02-021-4/+0
| | | | | | | | | | | | | | | | | | | Summary: Previously, Clang only emitted label names in assert builds. However there is a CC1 option -discard-value-names that should have been used to control emission instead. This patch removes the NDEBUG preprocessor block and instead allows LLVM to handle removing the names in accordance with the option. Reviewers: erichkeane, aaron.ballman, majnemer Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42829 llvm-svn: 324127
* Revert "Start setting dso_local in clang."Rafael Espindola2018-02-026-79/+11
| | | | | | | | This reverts commit r324107. I will have to test it on OS X. llvm-svn: 324108
* Start setting dso_local in clang.Rafael Espindola2018-02-026-11/+79
| | | | | | | | | | | | | | | | This starts adding dso_local to clang. The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go away. My objective for now is to move enough of it to clang to remove the need for the TargetMachine one to handle PIE copy relocations and -fno-plt. With that it should then be easy to implement a -fno-copy-reloc in clang. This patch just adds the cases where we assume a symbol to be local based on the file being compiled for an executable or a shared library. llvm-svn: 324107
* [CodeGen][va_args] Correct Vector Struct va-arg 'in_reg' code genErich Keane2018-02-021-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | When trying to track down a different bug, we discovered that calling __builtin_va_arg on a vec3f type caused the SROA pass to issue a warning that there was an illegal access. Further research showed that the vec3f type is alloca'ed as size '12', but the _builtin_va_arg code on x86_64 was always loading this out of registers as {double, double}. Thus, the 2nd store into the vec3f was storing in bytes 12-15! This patch alters the original implementation which always assumed {double, double} to use the actual coerced type instead, so the LLVM-IR generated is a load/GEP/store of a <2 x float> and a float, rather than a double and a double. Tests were added for all combinations I could think of that would fit in 2 FP registers, and all work exactly as expected. Differential Revision: https://reviews.llvm.org/D42811 llvm-svn: 324098
* [MinGW] Emit typeinfo locally for dllimported classes without key functionsMartin Storsjo2018-02-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | This fixes building Qt as shared libraries with clang in MinGW mode; previously subclasses of the QObjectData class (in other DLLs than the base DLL) failed to find the typeinfo symbols (that neither were emitted in the base DLL nor in the DLL containing the subclass). If the virtual destructor in the newly added testcase wouldn't be pure (or if there'd be another non-pure virtual method), it'd be a key function and things would work out even before this change. Make sure to locally emit the typeinfo for these classes as well. This matches what GCC does in this specific testcase. This fixes the root issue that spawned PR35146. (The difference to GCC that is initially described in that bug still is present though.) Differential Revision: https://reviews.llvm.org/D42641 llvm-svn: 324059
* Reverting patch rL323952 due to build errors that ISander de Smalen2018-02-0111-179/+71
| | | | | | haven't encountered in local builds. llvm-svn: 323956
* [DebugInfo] Enable debug information for C99 VLA typesSander de Smalen2018-02-0111-71/+179
| | | | | | | | | | | | | | | | | | | | | Summary: This patch enables debugging of C99 VLA types by generating more precise LLVM Debug metadata, using the extended DISubrange 'count' field that takes a DIVariable. This should implement: Bug 30553: Debug info generated for arrays is not what GDB expects (not as good as GCC's) https://bugs.llvm.org/show_bug.cgi?id=30553 Reviewers: echristo, aprantl, dexonsmith, clayborg, pcc, kristof.beyls, dblaikie Reviewed By: aprantl Subscribers: jholewinski, schweitz, davide, fhahn, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D41698 llvm-svn: 323952
OpenPOWER on IntegriCloud