summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP][NVPTX]Run parallel regions with num_threads clauses in SPMDAlexey Bataev2019-04-151-10/+7
| | | | | | | | | | mode. After the previous patch with the more correct handling of the number of threads in parallel regions, the parallel regions with num_threads clauses can be executed in SPMD mode. llvm-svn: 358445
* Relanding r357928 with fixed debuginfo check.Amy Huang2019-04-123-7/+27
| | | | | | | | | | | | | [MS] Add metadata for __declspec(allocator) Original summary: Emit !heapallocsite in the metadata for calls to functions marked with __declspec(allocator). Eventually this will be emitted as S_HEAPALLOCSITE debug info in codeview. Differential Revision: https://reviews.llvm.org/D60237 llvm-svn: 358307
* [Aarch64] Add v8.2-a half precision element extract intrinsicsDiogo N. Sampaio2019-04-121-0/+8
| | | | | | | | | | | | | | | | | | | | Summary: Implements the intrinsics define on the ACLE to extract half precision fp scalar elements from float16x4_t and float16x8_t vector types. a.k.a: vduph_lane_f16 vduph_laneq_f16 Reviewers: pablooliveira, olista01, LukeGeeson, DavidSpickett Reviewed By: DavidSpickett Subscribers: DavidSpickett, javed.absar, kristof.beyls, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60272 llvm-svn: 358276
* Variable auto-init: also auto-init allocaJF Bastien2019-04-125-84/+149
| | | | | | | | | | | | | | | | | | Summary: alloca isn’t auto-init’d right now because it’s a different path in clang that all the other stuff we support (it’s a builtin, not an expression). Interestingly, alloca doesn’t have a type (as opposed to even VLA) so we can really only initialize it with memset. <rdar://problem/49794007> Subscribers: jkorous, dexonsmith, cfe-commits, rjmccall, glider, kees, kcc, pcc Tags: #clang Differential Revision: https://reviews.llvm.org/D60548 llvm-svn: 358243
* Revert r357610, it caused PR41471Nico Weber2019-04-111-6/+0
| | | | llvm-svn: 358232
* [DebugInfo] Combine Trivial and NonTrivial flagsAaron Smith2019-04-111-4/+2
| | | | | | | | | | | | | | | | | | | | | Summary: These flags are used when emitting debug info and needed to initialize subprogram and member function attributes (function options) for Codeview. These function options are used to create an accurate compiler type for UDT symbols (class/struct/union) from PDBs. The Trivial flag was introduced in https://reviews.llvm.org/D45122 It's been pointed out that Trivial and NonTrivial may imply each other and that seems to be the case in the current tests. This change combines them into a single flag -- NonTrivial -- and updates the corresponding unit tests. There is an additional change to llvm to update the flags. Reviewers: rnk, zturner, dblaikie, probinson, Hui Reviewed By: dblaikie Subscribers: aprantl, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59347 llvm-svn: 358219
* Support objc_nonlazy_class attribute on Objective-C implementationsErik Pilkington2019-04-111-1/+2
| | | | | | | | Fixes rdar://49523079 Differential revision: https://reviews.llvm.org/D60544 llvm-svn: 358201
* Add { } to silence compiler warning [NFC]Mikael Holmen2019-04-111-3/+3
| | | | | | | | | | | | | | | At least clang 3.6 warns on the original code: ../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:829:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces] return std::array<Address, 1>({Address(nullptr, CharUnits::Zero())}); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { } ../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:833:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces] return std::array<Address, 2>({Address(nullptr, CharUnits::Zero()), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 errors generated. llvm-svn: 358152
* [OpenCL] Re-fix invalid address space generation for clk_event_t arguments ↵Alexey Sotkin2019-04-111-13/+28
| | | | | | | | | | | | | | | | | | | of enqueue_kernel builtin function Summary: https://reviews.llvm.org/D53809 fixed wrong address space(assert in debug build) generated for event_ret argument. But exactly the same problem exists for event_wait_list argument. This patch should fix both. Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: kristina, ebevhan, cfe-commits Differential Revision: https://reviews.llvm.org/D59985 llvm-svn: 358151
* Add IRGen APIs to fetch ctor/dtor helper functions for non-trivial structs.John McCall2019-04-101-0/+90
| | | | | | Patch by Tony Allevato! llvm-svn: 358132
* [OPENMP]Improve detection of number of teams, threads in targetAlexey Bataev2019-04-103-260/+393
| | | | | | | | | | regions. Added more complex analysis for number of teams and number of threads in the target regions, also merged related common code between CGOpenMPRuntime and CGOpenMPRuntimeNVPTX classes. llvm-svn: 358126
* Fix an off-by-one mistake in IRGen's copy-constructionJohn McCall2019-04-101-1/+1
| | | | | | | | special cases in the presence of zero-length arrays. Patch by Joran Bigalet! llvm-svn: 358115
* Don't emit an unreachable return block.John McCall2019-04-102-9/+15
| | | | | | Patch by Brad Moody. llvm-svn: 358104
* [CodeGen][ObjC] Emit the retainRV marker as a module flag instead ofAkira Hatanaka2019-04-101-8/+4
| | | | | | | | | | | | | | named metadata. This fixes a bug where ARC contract wasn't inserting the retainRV marker when LTO was enabled, which caused objects returned from a function to be auto-released. rdar://problem/49464214 Differential Revision: https://reviews.llvm.org/D60302 llvm-svn: 358048
* Revert "[MS] Add metadata for __declspec(allocator)"Amy Huang2019-04-083-27/+7
| | | | | | | This reverts commit e7bd735bb03a7b8141e32f7d6cb98e8914d8799e. Reverting because of buildbot failure. llvm-svn: 357952
* [OPENMP] Sync __kmpc_alloc/_kmpc_free function with the runtime.Alexey Bataev2019-04-081-10/+15
| | | | | | | Functions __kmpc_alloc/__kmpc_free are updated with the new interfaces. Patch synchronizes the compiler with the runtime. llvm-svn: 357933
* [MS] Add metadata for __declspec(allocator)Amy Huang2019-04-083-7/+27
| | | | | | | | | | | | | | | | | Summary: Emit !heapallocsite in the metadata for calls to functions marked with __declspec(allocator). Eventually this will be emitted as S_HEAPALLOCSITE debug info in codeview. Reviewers: rnk Subscribers: jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60237 llvm-svn: 357928
* [OPENMP][NVPTX]Fixed processing of memory management directives.Alexey Bataev2019-04-081-14/+42
| | | | | | | | | | | Added special processing of the memory management directives/clauses for NVPTX target. For private locals, omp_default_mem_alloc and omp_thread_mem_alloc result in allocation in local memory. omp_const_mem_alloc allocates const memory, omp_teams_mem_alloc allocates shared memory, and omp_cgroup_mem_alloc and omp_large_cap_mem_alloc allocate global memory. llvm-svn: 357923
* [IR] Refactor attribute methods in Function class (NFC)Evandro Menezes2019-04-041-1/+1
| | | | | | | | Rename the functions that query the optimization kind attributes. Differential revision: https://reviews.llvm.org/D60287 llvm-svn: 357731
* Make SourceManager::createFileID(UnownedTag, ...) take a const ↵Nico Weber2019-04-042-3/+4
| | | | | | | | | | | | | | | | | | | | | llvm::MemoryBuffer* Requires making the llvm::MemoryBuffer* stored by SourceManager const, which in turn requires making the accessors for that return const llvm::MemoryBuffer*s and updating all call sites. The original motivation for this was to use it and fix the TODO in CodeGenAction.cpp's ConvertBackendLocation() by using the UnownedTag version of createFileID, and since llvm::SourceMgr* hands out a const llvm::MemoryBuffer* this is required. I'm not sure if fixing the TODO this way actually works, but this seems like a good change on its own anyways. No intended behavior change. Differential Revision: https://reviews.llvm.org/D60247 llvm-svn: 357724
* [PR41276] Fixed incorrect generation of addr space cast for 'this' in C++.Anastasia Stulova2019-04-044-22/+26
| | | | | | | | | | | | | | | Improved classification of address space cast when qualification conversion is performed - prevent adding addr space cast for non-pointer and non-reference types. Take address space correctly from the pointee. Also pass correct address space from 'this' object using AggValueSlot when generating addrspacecast in the constructor call. Differential Revision: https://reviews.llvm.org/D59988 llvm-svn: 357682
* add periodsAmy Huang2019-04-031-6/+6
| | | | llvm-svn: 357643
* [IR] Create new method in `Function` class (NFC)Evandro Menezes2019-04-031-2/+1
| | | | | | | | | Create method `optForNone()` testing for the function level equivalent of `-O0` and refactor appropriately. Differential revision: https://reviews.llvm.org/D59852 llvm-svn: 357638
* [OPENMP]Add codegen for firstprivate vars with allocate clause.Alexey Bataev2019-04-033-14/+18
| | | | | | | Added codegen/test for the firstprivatized variables with the allocate clause. llvm-svn: 357617
* Bug-40323: MS ABI adding template static member in the linker directive ↵Jennifer Yu2019-04-031-0/+6
| | | | | | section to make sure init function can be called before main. llvm-svn: 357610
* [HIP-Clang] Fat binary should not be produced for non GPU codeAaron Enye Shi2019-04-021-2/+2
| | | | | | | | | | clang-format the changes to CUDA and HIP fat binary. Reviewers: yaxunl, tra Differential Revision: https://reviews.llvm.org/D60141 llvm-svn: 357532
* [HIP-Clang] Fat binary should not be produced for non GPU code 2Aaron Enye Shi2019-04-021-1/+3
| | | | | | | | | | Also for CUDA, we need to disable producing these fat binary functions when there is no GPU code. Reviewers: yaxunl, tra Differential Revision: https://reviews.llvm.org/D60141 llvm-svn: 357526
* [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
OpenPOWER on IntegriCloud