summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* PR19668, PR23034: Fix handling of move constructors and deleted copyRichard Smith2017-08-083-66/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | constructors when deciding whether classes should be passed indirectly. This fixes ABI differences between Clang and GCC: * Previously, Clang ignored the move constructor when making this determination. It now takes the move constructor into account, per https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may seem recent, but the ABI change was agreed on the Itanium C++ ABI list a long time ago). * Previously, Clang's behavior when the copy constructor was deleted was unstable -- depending on whether the lazy declaration of the copy constructor had been triggered, you might get different behavior. We now eagerly declare the copy constructor whenever its deletedness is unclear, and ignore deleted copy/move constructors when looking for a trivial such constructor. This also fixes an ABI difference between Clang and MSVC: * If the copy constructor would be implicitly deleted (but has not been lazily declared yet), for instance because the class has an rvalue reference member, we would pass it directly. We now pass such a class indirectly, matching MSVC. llvm-svn: 310401
* [OPENMP][DEBUG] Set proper address space info if required by target.Alexey Bataev2017-08-085-13/+154
| | | | | | | | | | | Arguments, passed to the outlined function, must have correct address space info for proper Debug info support. Patch sets global address space for arguments that are mapped and passed by reference. Also, cuda-gdb does not handle reference types correctly, so reference arguments are represented as pointers. llvm-svn: 310387
* [X86] Support 'avx5124vnniw' and 'avx5124fmaps' for __builtin_cpu_supports.Craig Topper2017-08-081-2/+4
| | | | | | They still need to be implemented in the intrinsics, the command line, and the backend. But this change isn't dependent on any of that and resolves a TODO. llvm-svn: 310386
* Revert "[OPENMP][DEBUG] Set proper address space info if required by target."Alexey Bataev2017-08-084-180/+18
| | | | | | This reverts commit r310377. llvm-svn: 310379
* [OPENMP][DEBUG] Set proper address space info if required by target.Alexey Bataev2017-08-084-18/+180
| | | | | | | | | | | Arguments, passed to the outlined function, must have correct address space info for proper Debug info support. Patch sets global address space for arguments that are mapped and passed by reference. Also, cuda-gdb does not handle reference types correctly, so reference arguments are represented as pointers. llvm-svn: 310377
* Revert "[OPENMP][DEBUG] Set proper address space info if required by target."Alexey Bataev2017-08-084-173/+13
| | | | | | This reverts commit r310360. llvm-svn: 310364
* [OPENMP][DEBUG] Set proper address space info if required by target.Alexey Bataev2017-08-084-13/+173
| | | | | | | | | | | Arguments, passed to the outlined function, must have correct address space info for proper Debug info support. Patch sets global address space for arguments that are mapped and passed by reference. Also, cuda-gdb does not handle reference types correctly, so reference arguments are represented as pointers. llvm-svn: 310360
* [codeview] Fix class name formattingReid Kleckner2017-08-082-8/+21
| | | | | | | In particular, removes spaces between template arguments of class templates to better match VS type visualizers. llvm-svn: 310331
* Revert "[Coverage] Precise region termination with deferred regions"Vedant Kumar2017-08-051-86/+5
| | | | | | | | | | | | | | This reverts commit r310010. I don't think there's anything wrong with this commit, but it's causing clang to generate output that llvm-cov doesn't do a good job with and the fix isn't immediately clear. See Eli's comment in D36250 for more context. I'm reverting the clang change so the coverage bot can revert back to producing sensible output, and to give myself some time to investigate what went wrong in llvm. llvm-svn: 310154
* Debug Info: Set the DICompileUnit's isOptimized flag when compiling with LTO.Adrian Prantl2017-08-041-6/+5
| | | | | | rdar://problem/27640939 llvm-svn: 310147
* Clean up some lambda conversion operator code, NFCReid Kleckner2017-08-043-23/+15
| | | | | | | | | | | | | | We don't need special handling in CodeGenFunction::GenerateCode for lambda block pointer conversion operators anymore. The conversion operator emission code immediately calls back to the generic EmitFunctionBody. Rename EmitLambdaStaticInvokeFunction to EmitLambdaStaticInvokeBody for better consistency with the other Emit*Body methods. I'm preparing to do something about PR28299, which touches this code. llvm-svn: 310145
* Revert "[OPENMP][DEBUG] Set proper address space info if required by target."Alexey Bataev2017-08-044-174/+13
| | | | | | This reverts commit r310104. llvm-svn: 310135
* Revert "[OPENMP] Fix for pacify buildbots, NFC."Alexey Bataev2017-08-041-12/+18
| | | | | | This reverts commit r310120. llvm-svn: 310134
* Reland "CFI: blacklist STL allocate() from unrelated-casts"Vlad Tsyrklevich2017-08-041-0/+28
| | | | | | | | Reland r310097 with a fix for a debug assertion in NamedDecl.getName() Differential Revision: https://reviews.llvm.org/D36294 llvm-svn: 310132
* Revert "Reland "CFI: blacklist STL allocate() from unrelated-casts""Vlad Tsyrklevich2017-08-041-27/+0
| | | | | | This reverts commit r310105. llvm-svn: 310121
* [OPENMP] Fix for pacify buildbots, NFC.Alexey Bataev2017-08-041-18/+12
| | | | llvm-svn: 310120
* Reland "CFI: blacklist STL allocate() from unrelated-casts"Vlad Tsyrklevich2017-08-041-0/+27
| | | | | | | | Reland r310097 with a unit test fix for MS ABI build bots. Differential Revision: https://reviews.llvm.org/D36294 llvm-svn: 310105
* [OPENMP][DEBUG] Set proper address space info if required by target.Alexey Bataev2017-08-044-13/+174
| | | | | | | | | | | Arguments, passed to the outlined function, must have correct address space info for proper Debug info support. Patch sets global address space for arguments that are mapped and passed by reference. Also, cuda-gdb does not handle reference types correctly, so reference arguments are represented as pointers. llvm-svn: 310104
* Revert "CFI: blacklist STL allocate() from unrelated-casts"Vlad Tsyrklevich2017-08-041-27/+0
| | | | | | This reverts commit r310097. llvm-svn: 310099
* [OPENMP] Unify generation of outlined function calls.Alexey Bataev2017-08-044-12/+31
| | | | llvm-svn: 310098
* CFI: blacklist STL allocate() from unrelated-castsVlad Tsyrklevich2017-08-041-0/+27
| | | | | | | | | | | | | | | | | | | | | | Summary: Previously, STL allocators were blacklisted in compiler_rt's cfi_blacklist.txt because they mandated a cast from void* to T* before object initialization completed. This change moves that logic into the front end because C++ name mangling supports a substitution compression mechanism for symbols that makes it difficult to blacklist the mangled symbol for allocate() using a regular expression. Motivated by crbug.com/751385. Reviewers: pcc, kcc Reviewed By: pcc Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36294 llvm-svn: 310097
* Add OpenCL 2.0 atomic builtin functions as Clang builtinYaxun Liu2017-08-044-37/+183
| | | | | | | | | | | | | | | | | | | | | OpenCL 2.0 atomic builtin functions have a scope argument which is ideally represented as synchronization scope argument in LLVM atomic instructions. Clang supports translating Clang atomic builtin functions to LLVM atomic instructions. However it currently does not support synchronization scope of LLVM atomic instructions. Without this, users have to use LLVM assembly code to implement OpenCL atomic builtin functions. This patch adds OpenCL 2.0 atomic builtin functions as Clang builtin functions, which supports generating LLVM atomic instructions with synchronization scope operand. Currently only constant memory scope argument is supported. Support of non-constant memory scope argument will be added later. Differential Revision: https://reviews.llvm.org/D28691 llvm-svn: 310082
* Revert "[coverage] Special-case calls to noreturn functions."Vedant Kumar2017-08-041-12/+0
| | | | | | | | | | | This reverts commit r309995. It looks like it's responsible for breaking the stage2 coverage build: http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1402 The cfe-commits discussion re: r309995 has more context. llvm-svn: 310019
* [Coverage] Precise region termination with deferred regionsVedant Kumar2017-08-041-5/+86
| | | | | | | | | | | | | | | | | | | | | | | | The current coverage implementation doesn't handle region termination very precisely. Take for example an `if' statement with a `return': void f() { if (true) { return; // The `if' body's region is terminated here. } // This line gets the same coverage as the `if' condition. } If the function `f' is called, the line containing the comment will be marked as having executed once, which is not correct. The solution here is to create a deferred region after terminating a region. The deferred region is completed once the start location of the next statement is known, and is then pushed onto the region stack. In the cases where it's not possible to complete a deferred region, it can safely be dropped. Testing: lit test updates, a stage2 coverage-enabled build of clang llvm-svn: 310010
* [coverage] Special-case calls to noreturn functions.Eli Friedman2017-08-031-0/+12
| | | | | | | | | | | The code after a noreturn call doesn't execute. The pattern in the testcase is pretty common in LLVM (a switch with a default case that calls llvm_unreachable). Differential Revision: https://reviews.llvm.org/D36250 llvm-svn: 309995
* [mips] Revert r309942 & r309940Simon Dardis2017-08-031-14/+0
| | | | | | | | This reverts commit r309942 & commit r309940. A revert was requested following post commit review. llvm-svn: 309978
* [mips] Implement -muninit-const-in-rodataSimon Dardis2017-08-031-0/+14
| | | | | | | | | | | This option when combined with -mgpopt and -membedded-data places all uninitialized constant variables in the read-only section. Reviewers: atanasyan, nitesh.jain Differential Revision: https://reviews.llvm.org/D35917 llvm-svn: 309940
* Update for llvm change.Rafael Espindola2017-08-031-10/+12
| | | | llvm-svn: 309912
* [coverage] Make smaller regions for the first case of a switch.Eli Friedman2017-08-021-6/+13
| | | | | | | | | | | | | We never overwrite the end location of a region, so we would end up with an overly large region when we reused the switch's region. It's possible this code will be substantially rewritten in the near future to deal with fallthrough more accurately, but this seems like an improvement on its own for now. Differential Revision: https://reviews.llvm.org/D34801 llvm-svn: 309901
* [ubsan] Have -fsanitize=vptr emit a null check if -fsanitize=null isn't ↵Vedant Kumar2017-08-021-4/+4
| | | | | | | | | | | | | | | | | | available In r309007, I made -fsanitize=null a hard prerequisite for -fsanitize=vptr. I did not see the need for the two checks to have separate null checking logic for the same pointer. I expected the two checks to either always be enabled together, or to be mutually compatible. In the mailing list discussion re: r309007 it became clear that that isn't the case. If a codebase is -fsanitize=vptr clean but not -fsanitize=null clean, it's useful to have -fsanitize=vptr emit its own null check. That's what this patch does: with it, -fsanitize=vptr can be used without -fsanitize=null. Differential Revision: https://reviews.llvm.org/D36112 llvm-svn: 309846
* Fix creating bitcasts with wrong address spaceMatt Arsenault2017-08-011-2/+4
| | | | | | | | In a future commit AMDGPU will start passing aggregates directly to more functions, triggering asserts in test/CodeGenOpenCL/addr-space-struct-arg.cl llvm-svn: 309741
* [OpenCL] Add missing subgroup builtinsJoey Gouly2017-08-011-0/+19
| | | | | | | This adds get_kernel_max_sub_group_size_for_ndrange and get_kernel_sub_group_count_for_ndrange. llvm-svn: 309678
* Re-apply r309622 with a fix for MSVC.Peter Collingbourne2017-07-311-5/+4
| | | | | | Patch by Vlad Tsyrklevich! llvm-svn: 309635
* Revert r309622, "Fix logic for generating llvm.type.test()s"Peter Collingbourne2017-07-311-4/+5
| | | | | | | Caused a bot test failure: http://bb.pgr.jp/builders/test-clang-msc-x64-on-i686-linux-RA/builds/5325 llvm-svn: 309624
* Fix logic for generating llvm.type.test()sPeter Collingbourne2017-07-311-5/+4
| | | | | | | | | | | | | | CodeGenFunction::EmitTypeMetadataCodeForVCall() could output an llvm.assume(llvm.type.test())when CFI was enabled, optimizing out the vcall check. This case was only reached when: 1) CFI-vcall was enabled, 2) -fwhole-program-tables was specified, and 3) -fno-sanitize-trap=cfi-vcall was specified. Patch by Vlad Tsyrklevich! Differential Revision: https://reviews.llvm.org/D36013 llvm-svn: 309622
* [OPENMP] Change the name of outer non-debug function in debug mode, NFC.Alexey Bataev2017-07-311-2/+4
| | | | llvm-svn: 309575
* [coroutines] Evaluate the operand of void `co_return` expressions.Eric Fiselier2017-07-311-0/+7
| | | | | | | | | | | | | | | | | Summary: Previously Clang incorrectly ignored the expression of a void `co_return`. This patch addresses that bug. I'm not quite sure if I got the code-gen right, but this patch is at least a start. Reviewers: rsmith, GorNishanov Reviewed By: rsmith, GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36070 llvm-svn: 309545
* CodeGenModule.cpp: [PR33810][Modules] Remove an assertion that confirms ↵NAKAMURA Takumi2017-07-301-2/+0
| | | | | | | MangledDeclNames[CanonicalGD] might be still empty. FIXME: It is accepted that MangledDeclNames[CanonicalGD] is overwritten here? llvm-svn: 309504
* CodeGenModule.cpp: [PR33810][Modules] Avoid reusing FoundStr to try to fix ↵NAKAMURA Takumi2017-07-301-6/+6
| | | | | | | | crash. MangledDeclNames might grow up and be reallocated when it were reused by reentering CodeGenModule::getMangledName(). llvm-svn: 309501
* CodeGenModule.cpp: [PR33810][Modules] Make sure actual memory corruption ↵NAKAMURA Takumi2017-07-301-0/+2
| | | | | | before random crash with -fmodules. llvm-svn: 309499
* Fix incorrect assertion condition.Victor Leschuk2017-07-291-2/+2
| | | | llvm-svn: 309484
* [ubsan] Diagnose invalid uses of builtins (clang)Vedant Kumar2017-07-292-2/+34
| | | | | | | | | | | | | | | On some targets, passing zero to the clz() or ctz() builtins has undefined behavior. I ran into this issue while debugging UB in __hash_table from libcxx: the bug I was seeing manifested itself differently under -O0 vs -Os, due to a UB call to clz() (see: libcxx/r304617). This patch introduces a check which can detect UB calls to builtins. llvm.org/PR26979 Differential Revision: https://reviews.llvm.org/D34590 llvm-svn: 309459
* Adopt to LLVM API change (llvm.dbg.value no longer has an offset)Adrian Prantl2017-07-281-1/+1
| | | | llvm-svn: 309427
* [sanitizer-coverage] clang flags pumbing for -fsanitize-coverage=pc-tableKostya Serebryany2017-07-281-0/+1
| | | | llvm-svn: 309338
* Revert r264998 and r265035.Akira Hatanaka2017-07-271-2/+10
| | | | | | | | | | r303175 made changes to have __cxa_allocate_exception return a 16-byte aligned pointer, so it's no longer necessary to specify a lower alignment (8-bytes) for exception objects on Darwin. rdar://problem/32363695 llvm-svn: 309308
* Fix double destruction of objects when OpenMP construct is canceledErich Keane2017-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an omp for loop is canceled the constructed objects are being destructed twice. It looks like the desired code is: { Obj o; If (cancelled) branch-through-cleanups to cancel.exit. } [cleanups] cancel.exit: __kmpc_for_static_fini br cancel.cont (*) cancel.cont: __kmpc_barrier return The problem seems to be the branch to cancel.cont is currently also going through the cleanups calling them again. This change just does a direct branch instead. Patch By: michael.p.rice@intel.com Differential Revision: https://reviews.llvm.org/D35854 llvm-svn: 309288
* Make new PM honor -fdebug-info-for-profiling (clang side)Dehao Chen2017-07-271-22/+21
| | | | | | | | | | | | | | Summary: The new PM needs to invoke add-discriminator pass when building with -fdebug-info-for-profiling. Reviewers: chandlerc, davidxl Reviewed By: chandlerc Subscribers: sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D35746 llvm-svn: 309282
* [OPENMP] Codegen for 'in_reduction' clause.Alexey Bataev2017-07-271-0/+50
| | | | | | | | | | | | | | | | | | Added codegen for task-based directive with in_reduction clause. ``` <body> ``` The next code is emitted: ``` void *td; ... td = call i8* @__kmpc_task_reduction_init(); ... <type> *priv = (<type> *)call i8* @__kmpc_task_reduction_get_th_data(i32 GTID, i8* td, i8* <orig>) ``` llvm-svn: 309270
* [CodeGen][ARM] ARM runtime helper functions are not always soft-fpPeter Smith2017-07-271-10/+7
| | | | | | | Re-commit r309257 with less precise register checks in arm-float-helpers.c test. llvm-svn: 309263
* [CodeGen][ARM] Revert r309257Peter Smith2017-07-271-7/+10
| | | | | | | The test arm-float-helpers.c appears to be failing on some builders and needs some work to make it more robust. llvm-svn: 309259
OpenPOWER on IntegriCloud