summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang] Preserve names of addrspacecast'ed values.Vyacheslav Zakharin2019-07-101-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D63846 llvm-svn: 365666
* [AMDGPU] Increased the number of implicit argument bytes for both OpenCL and ↵Christudasan Devadasan2019-07-101-1/+1
| | | | | | | | | | | | | HIP (CLANG). To enable a new implicit kernel argument, increased the number of argument bytes from 48 to 56. Reviewed By: yaxunl Differential Revision: https://reviews.llvm.org/D63756 llvm-svn: 365643
* [AMDGPU] gfx908 clang targetStanislav Mekhanoshin2019-07-091-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D64430 llvm-svn: 365528
* Revert Revert Devirtualize destructor of final class.Hiroshi Yamauchi2019-07-091-3/+27
| | | | | | | | | Revert r364359 and recommit r364100. r364100 was reverted as r364359 due to an internal test failure, but it was a false alarm. llvm-svn: 365509
* Ignore trailing NullStmts in StmtExprs for GCC compatibility.Aaron Ballman2019-07-091-32/+36
| | | | | | | | Ignore trailing NullStmts in compound expressions when determining the result type and value. This is to match the GCC behavior which ignores semicolons at the end of compound expressions. Patch by Dominic Ferreira. llvm-svn: 365498
* [NFC] [X86] Fix scan-build complainingPengfei Wang2019-07-091-3/+2
| | | | | | | | | | | | | | | | | | Summary: Remove unused variable. This fixes bug: https://bugs.llvm.org/show_bug.cgi?id=42526 Signed-off-by: pengfei <pengfei.wang@intel.com> Reviewers: RKSimon, xiangzhangllvm, craig.topper Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64389 llvm-svn: 365473
* [BPF] Preserve debuginfo array/union/struct type/access indexYonghong Song2019-07-094-4/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For background of BPF CO-RE project, please refer to http://vger.kernel.org/bpfconf2019.html In summary, BPF CO-RE intends to compile bpf programs adjustable on struct/union layout change so the same program can run on multiple kernels with adjustment before loading based on native kernel structures. In order to do this, we need keep track of GEP(getelementptr) instruction base and result debuginfo types, so we can adjust on the host based on kernel BTF info. Capturing such information as an IR optimization is hard as various optimization may have tweaked GEP and also union is replaced by structure it is impossible to track fieldindex for union member accesses. Three intrinsic functions, preserve_{array,union,struct}_access_index, are introducted. addr = preserve_array_access_index(base, index, dimension) addr = preserve_union_access_index(base, di_index) addr = preserve_struct_access_index(base, gep_index, di_index) here, base: the base pointer for the array/union/struct access. index: the last access index for array, the same for IR/DebugInfo layout. dimension: the array dimension. gep_index: the access index based on IR layout. di_index: the access index based on user/debuginfo types. If using these intrinsics blindly, i.e., transforming all GEPs to these intrinsics and later on reducing them to GEPs, we have seen up to 7% more instructions generated. To avoid such an overhead, a clang builtin is proposed: base = __builtin_preserve_access_index(base) such that user wraps to-be-relocated GEPs in this builtin and preserve_*_access_index intrinsics only apply to those GEPs. Such a buyin will prevent performance degradation if people do not use CO-RE, even for programs which use bpf_probe_read(). For example, for the following example, $ cat test.c struct sk_buff { int i; int b1:1; int b2:2; union { struct { int o1; int o2; } o; struct { char flags; char dev_id; } dev; int netid; } u[10]; }; static int (*bpf_probe_read)(void *dst, int size, const void *unsafe_ptr) = (void *) 4; #define _(x) (__builtin_preserve_access_index(x)) int bpf_prog(struct sk_buff *ctx) { char dev_id; bpf_probe_read(&dev_id, sizeof(char), _(&ctx->u[5].dev.dev_id)); return dev_id; } $ clang -target bpf -O2 -g -emit-llvm -S -mllvm -print-before-all \ test.c >& log The generated IR looks like below: ... define dso_local i32 @bpf_prog(%struct.sk_buff*) #0 !dbg !15 { %2 = alloca %struct.sk_buff*, align 8 %3 = alloca i8, align 1 store %struct.sk_buff* %0, %struct.sk_buff** %2, align 8, !tbaa !45 call void @llvm.dbg.declare(metadata %struct.sk_buff** %2, metadata !43, metadata !DIExpression()), !dbg !49 call void @llvm.lifetime.start.p0i8(i64 1, i8* %3) #4, !dbg !50 call void @llvm.dbg.declare(metadata i8* %3, metadata !44, metadata !DIExpression()), !dbg !51 %4 = load i32 (i8*, i32, i8*)*, i32 (i8*, i32, i8*)** @bpf_probe_read, align 8, !dbg !52, !tbaa !45 %5 = load %struct.sk_buff*, %struct.sk_buff** %2, align 8, !dbg !53, !tbaa !45 %6 = call [10 x %union.anon]* @llvm.preserve.struct.access.index.p0a10s_union.anons.p0s_struct.sk_buffs( %struct.sk_buff* %5, i32 2, i32 3), !dbg !53, !llvm.preserve.access.index !19 %7 = call %union.anon* @llvm.preserve.array.access.index.p0s_union.anons.p0a10s_union.anons( [10 x %union.anon]* %6, i32 1, i32 5), !dbg !53 %8 = call %union.anon* @llvm.preserve.union.access.index.p0s_union.anons.p0s_union.anons( %union.anon* %7, i32 1), !dbg !53, !llvm.preserve.access.index !26 %9 = bitcast %union.anon* %8 to %struct.anon.0*, !dbg !53 %10 = call i8* @llvm.preserve.struct.access.index.p0i8.p0s_struct.anon.0s( %struct.anon.0* %9, i32 1, i32 1), !dbg !53, !llvm.preserve.access.index !34 %11 = call i32 %4(i8* %3, i32 1, i8* %10), !dbg !52 %12 = load i8, i8* %3, align 1, !dbg !54, !tbaa !55 %13 = sext i8 %12 to i32, !dbg !54 call void @llvm.lifetime.end.p0i8(i64 1, i8* %3) #4, !dbg !56 ret i32 %13, !dbg !57 } !19 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "sk_buff", file: !3, line: 1, size: 704, elements: !20) !26 = distinct !DICompositeType(tag: DW_TAG_union_type, scope: !19, file: !3, line: 5, size: 64, elements: !27) !34 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !26, file: !3, line: 10, size: 16, elements: !35) Note that @llvm.preserve.{struct,union}.access.index calls have metadata llvm.preserve.access.index attached to instructions to provide struct/union debuginfo type information. For &ctx->u[5].dev.dev_id, . The "%6 = ..." represents struct member "u" with index 2 for IR layout and index 3 for DI layout. . The "%7 = ..." represents array subscript "5". . The "%8 = ..." represents union member "dev" with index 1 for DI layout. . The "%10 = ..." represents struct member "dev_id" with index 1 for both IR and DI layout. Basically, traversing the use-def chain recursively for the 3rd argument of bpf_probe_read() and examining all preserve_*_access_index calls, the debuginfo struct/union/array access index can be achieved. The intrinsics also contain enough information to regenerate codes for IR layout. For array and structure intrinsics, the proper GEP can be constructed. For union intrinsics, replacing all uses of "addr" with "base" should be enough. Signed-off-by: Yonghong Song <yhs@fb.com> Differential Revision: https://reviews.llvm.org/D61809 llvm-svn: 365438
* Revert "[BPF] Preserve debuginfo array/union/struct type/access index"Yonghong Song2019-07-094-85/+4
| | | | | | | | | This reverts commit r365435. Forgot adding the Differential Revision link. Will add to the commit message and resubmit. llvm-svn: 365436
* [BPF] Preserve debuginfo array/union/struct type/access indexYonghong Song2019-07-094-4/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For background of BPF CO-RE project, please refer to http://vger.kernel.org/bpfconf2019.html In summary, BPF CO-RE intends to compile bpf programs adjustable on struct/union layout change so the same program can run on multiple kernels with adjustment before loading based on native kernel structures. In order to do this, we need keep track of GEP(getelementptr) instruction base and result debuginfo types, so we can adjust on the host based on kernel BTF info. Capturing such information as an IR optimization is hard as various optimization may have tweaked GEP and also union is replaced by structure it is impossible to track fieldindex for union member accesses. Three intrinsic functions, preserve_{array,union,struct}_access_index, are introducted. addr = preserve_array_access_index(base, index, dimension) addr = preserve_union_access_index(base, di_index) addr = preserve_struct_access_index(base, gep_index, di_index) here, base: the base pointer for the array/union/struct access. index: the last access index for array, the same for IR/DebugInfo layout. dimension: the array dimension. gep_index: the access index based on IR layout. di_index: the access index based on user/debuginfo types. If using these intrinsics blindly, i.e., transforming all GEPs to these intrinsics and later on reducing them to GEPs, we have seen up to 7% more instructions generated. To avoid such an overhead, a clang builtin is proposed: base = __builtin_preserve_access_index(base) such that user wraps to-be-relocated GEPs in this builtin and preserve_*_access_index intrinsics only apply to those GEPs. Such a buyin will prevent performance degradation if people do not use CO-RE, even for programs which use bpf_probe_read(). For example, for the following example, $ cat test.c struct sk_buff { int i; int b1:1; int b2:2; union { struct { int o1; int o2; } o; struct { char flags; char dev_id; } dev; int netid; } u[10]; }; static int (*bpf_probe_read)(void *dst, int size, const void *unsafe_ptr) = (void *) 4; #define _(x) (__builtin_preserve_access_index(x)) int bpf_prog(struct sk_buff *ctx) { char dev_id; bpf_probe_read(&dev_id, sizeof(char), _(&ctx->u[5].dev.dev_id)); return dev_id; } $ clang -target bpf -O2 -g -emit-llvm -S -mllvm -print-before-all \ test.c >& log The generated IR looks like below: ... define dso_local i32 @bpf_prog(%struct.sk_buff*) #0 !dbg !15 { %2 = alloca %struct.sk_buff*, align 8 %3 = alloca i8, align 1 store %struct.sk_buff* %0, %struct.sk_buff** %2, align 8, !tbaa !45 call void @llvm.dbg.declare(metadata %struct.sk_buff** %2, metadata !43, metadata !DIExpression()), !dbg !49 call void @llvm.lifetime.start.p0i8(i64 1, i8* %3) #4, !dbg !50 call void @llvm.dbg.declare(metadata i8* %3, metadata !44, metadata !DIExpression()), !dbg !51 %4 = load i32 (i8*, i32, i8*)*, i32 (i8*, i32, i8*)** @bpf_probe_read, align 8, !dbg !52, !tbaa !45 %5 = load %struct.sk_buff*, %struct.sk_buff** %2, align 8, !dbg !53, !tbaa !45 %6 = call [10 x %union.anon]* @llvm.preserve.struct.access.index.p0a10s_union.anons.p0s_struct.sk_buffs( %struct.sk_buff* %5, i32 2, i32 3), !dbg !53, !llvm.preserve.access.index !19 %7 = call %union.anon* @llvm.preserve.array.access.index.p0s_union.anons.p0a10s_union.anons( [10 x %union.anon]* %6, i32 1, i32 5), !dbg !53 %8 = call %union.anon* @llvm.preserve.union.access.index.p0s_union.anons.p0s_union.anons( %union.anon* %7, i32 1), !dbg !53, !llvm.preserve.access.index !26 %9 = bitcast %union.anon* %8 to %struct.anon.0*, !dbg !53 %10 = call i8* @llvm.preserve.struct.access.index.p0i8.p0s_struct.anon.0s( %struct.anon.0* %9, i32 1, i32 1), !dbg !53, !llvm.preserve.access.index !34 %11 = call i32 %4(i8* %3, i32 1, i8* %10), !dbg !52 %12 = load i8, i8* %3, align 1, !dbg !54, !tbaa !55 %13 = sext i8 %12 to i32, !dbg !54 call void @llvm.lifetime.end.p0i8(i64 1, i8* %3) #4, !dbg !56 ret i32 %13, !dbg !57 } !19 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "sk_buff", file: !3, line: 1, size: 704, elements: !20) !26 = distinct !DICompositeType(tag: DW_TAG_union_type, scope: !19, file: !3, line: 5, size: 64, elements: !27) !34 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !26, file: !3, line: 10, size: 16, elements: !35) Note that @llvm.preserve.{struct,union}.access.index calls have metadata llvm.preserve.access.index attached to instructions to provide struct/union debuginfo type information. For &ctx->u[5].dev.dev_id, . The "%6 = ..." represents struct member "u" with index 2 for IR layout and index 3 for DI layout. . The "%7 = ..." represents array subscript "5". . The "%8 = ..." represents union member "dev" with index 1 for DI layout. . The "%10 = ..." represents struct member "dev_id" with index 1 for both IR and DI layout. Basically, traversing the use-def chain recursively for the 3rd argument of bpf_probe_read() and examining all preserve_*_access_index calls, the debuginfo struct/union/array access index can be achieved. The intrinsics also contain enough information to regenerate codes for IR layout. For array and structure intrinsics, the proper GEP can be constructed. For union intrinsics, replacing all uses of "addr" with "base" should be enough. Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 365435
* Treat the range of representable values of floating-point types as [-inf, ↵Richard Smith2019-07-061-120/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +inf] not as [-max, +max]. Summary: Prior to r329065, we used [-max, max] as the range of representable values because LLVM's `fptrunc` did not guarantee defined behavior when truncating from a larger floating-point type to a smaller one. Now that has been fixed, we can make clang follow normal IEEE 754 semantics in this regard and take the larger range [-inf, +inf] as the range of representable values. In practice, this affects two parts of the frontend: * the constant evaluator no longer treats floating-point evaluations that result in +-inf as being undefined (because they no longer leave the range of representable values of the type) * UBSan no longer treats conversions to floating-point type that are outside the [-max, +max] range as being undefined In passing, also remove the float-divide-by-zero sanitizer from -fsanitize=undefined, on the basis that while it's undefined per C++ rules (and we disallow it in constant expressions for that reason), it is defined by Clang / LLVM / IEEE 754. Reviewers: rnk, BillyONeal Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63793 llvm-svn: 365272
* NFC: Add an explicit return for safety and consistencyHamza Sood2019-07-051-0/+2
| | | | | | | This case implicitly falls-through, which is fine now as it's at the end of the function, but it seems like an accident waiting to happen. llvm-svn: 365210
* Silence gcc warning "control reaches end of non-void function" [NFCI]Mikael Holmen2019-07-051-0/+2
| | | | | | | | | | | | | | Without this fix gcc (7.4) complains with /data/repo/master/clang/lib/CodeGen/CGObjCMac.cpp: In member function 'std::__cxx11::string {anonymous}::CGObjCCommonMac::GetSectionName(llvm::StringRef, llvm::StringRef)': /data/repo/master/clang/lib/CodeGen/CGObjCMac.cpp:4944:1: error: control reaches end of non-void function [-Werror=return-type] } ^ All values in the ObjectFormatType enum are currently handled in the switch but gcc complains anyway. llvm-svn: 365174
* [NFC] Make some ObjectFormatType switches coveringHubert Tong2019-07-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch removes the `default` case from some switches on `llvm::Triple::ObjectFormatType`, and cases for the missing enumerators are then added. For `UnknownObjectFormat`, the action (`llvm_unreachable`) for the `default` case is kept. For the other unhandled cases, `report_fatal_error` is used instead. Reviewers: sfertile, jasonliu, daltenty Reviewed By: sfertile Subscribers: wuzish, aheejin, jsji, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D63767 llvm-svn: 365160
* [Bitcode] Move Bitstream to a separate libraryFrancis Visoiu Mistrih2019-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This moves Bitcode/Bitstream*, Bitcode/BitCodes.h to Bitstream/. This is needed to avoid a circular dependency when using the bitstream code for parsing optimization remarks. Since Bitcode uses Core for the IR part: libLLVMRemarks -> Bitcode -> Core and Core uses libLLVMRemarks to generate remarks (see IR/RemarkStreamer.cpp): Core -> libLLVMRemarks we need to separate the Bitstream and Bitcode part. For clang-doc, it seems that it doesn't need the whole bitcode layer, so I updated the CMake to only use the bitstream part. Differential Revision: https://reviews.llvm.org/D63899 llvm-svn: 365091
* Change std::{lower,upper}_bound to llvm::{lower,upper}_bound or ↵Fangrui Song2019-07-032-3/+2
| | | | | | llvm::partition_point. NFC llvm-svn: 365006
* [C++2a] Add __builtin_bit_cast, used to implement std::bit_castErik Pilkington2019-07-025-0/+39
| | | | | | | | | | | | | | | | | | This commit adds a new builtin, __builtin_bit_cast(T, v), which performs a bit_cast from a value v to a type T. This expression can be evaluated at compile time under specific circumstances. The compile time evaluation currently doesn't support bit-fields, but I'm planning on fixing this in a follow up (some of the logic for figuring this out is in CodeGen). I'm also planning follow-ups for supporting some more esoteric types that the constexpr evaluator supports, as well as extending __builtin_memcpy constexpr evaluation to use the same infrastructure. rdar://44987528 Differential revision: https://reviews.llvm.org/D62825 llvm-svn: 364954
* Revert "[clang][NewPM] Fix broken profile test"Leonard Chan2019-06-291-6/+0
| | | | | | | | This reverts commit ab2c0ed01edfec9a9402d03bdf8633b34b73f3a7. See https://reviews.llvm.org/D63155 llvm-svn: 364692
* [OPENMP]Generate correctly implicit flags for mapped data.Alexey Bataev2019-06-271-7/+19
| | | | | | | Implicit flag must not be emitted for explicitly specified firstprivate variables, but for implicitly captured sizes of the VLAs. llvm-svn: 364575
* [clang] Add DISuprogram and DIE for a func declDjordje Todorovic2019-06-273-6/+56
| | | | | | | | | | | | | | | Attach a unique DISubprogram to a function declaration that will be used for call site debug info. ([7/13] Introduce the debug entry values.) Co-authored-by: Ananth Sowda <asowda@cisco.com> Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com> Co-authored-by: Ivan Baev <ibaev@cisco.com> Differential Revision: https://reviews.llvm.org/D60714 llvm-svn: 364502
* [NFC] Return early for types with size zeroVitaly Buka2019-06-271-3/+4
| | | | llvm-svn: 364495
* [NFC] Remove unneeded local variablesVitaly Buka2019-06-271-9/+5
| | | | llvm-svn: 364492
* Fix formatting after r364479Aaron Puchert2019-06-261-4/+2
| | | | | | | The reflowing obscurs the functional changes, so here is a separate commit. llvm-svn: 364480
* [Clang] Remove unused -split-dwarf and obsolete -enable-split-dwarfAaron Puchert2019-06-262-9/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: The changes in D59673 made the choice redundant, since we can achieve single-file split DWARF just by not setting an output file name. Like llc we can also derive whether to enable Split DWARF from whether -split-dwarf-file is set, so we don't need the flag at all anymore. The test CodeGen/split-debug-filename.c distinguished between having set or not set -enable-split-dwarf with -split-dwarf-file, but we can probably just always emit the metadata into the IR. The flag -split-dwarf wasn't used at all anymore. Reviewers: dblaikie, echristo Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D63167 llvm-svn: 364479
* Make CodeGen depend on ASTMatchersMichael Liao2019-06-261-0/+1
| | | | | | - Shared library builds are broken due to the missing dependency. llvm-svn: 364428
* [clang/DIVar] Emit the flag for params that have unmodified valueDjordje Todorovic2019-06-262-0/+43
| | | | | | | | | | | | | | | Emit the debug info flag that indicates that a parameter has unchanged value throughout a function. ([5/13] Introduce the debug entry values.) Co-authored-by: Ananth Sowda <asowda@cisco.com> Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com> Co-authored-by: Ivan Baev <ibaev@cisco.com> Differential Revision: https://reviews.llvm.org/D58035 llvm-svn: 364424
* [CC1Option] Add the option to enable the debug entry valuesDjordje Todorovic2019-06-262-1/+5
| | | | | | | | | | | | | | | | | | | | | The option enables debug info about parameter's entry values. The example of using the option: clang -g -O2 -Xclang -femit-debug-entry-values test.c In addition, when the option is set add the flag all_call_sites in a subprogram in order to support GNU extension as well. ([3/13] Introduce the debug entry values.) Co-authored-by: Ananth Sowda <asowda@cisco.com> Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com> Co-authored-by: Ivan Baev <ibaev@cisco.com> Differential Revision: https://reviews.llvm.org/D58033 llvm-svn: 364399
* [HIP] Support attribute hip_pinned_shadowYaxun Liu2019-06-262-6/+26
| | | | | | | | | | | | | | | This patch introduces support of hip_pinned_shadow variable for HIP. A hip_pinned_shadow variable is a global variable with attribute hip_pinned_shadow. It has external linkage on device side and has no initializer. It has internal linkage on host side and has initializer or static constructor. It can be accessed in both device code and host code. This allows HIP runtime to implement support of HIP texture reference. Differential Revision: https://reviews.llvm.org/D62738 llvm-svn: 364381
* Revert Devirtualize destructor of final class.Rumeet Dhindsa2019-06-251-27/+3
| | | | | | This reverts r364100 (git commit 405c2b16225fc6eaf5eb8ba3ce584699a3b159ef) llvm-svn: 364359
* [OPENMP]Fix PR41966: type mismatch in runtime functions.Alexey Bataev2019-06-252-54/+71
| | | | | | | Target-based runtime functions use int64_t type for sizes, while the compiler uses size_t type. It leads to miscompilation in 32 bit mode. llvm-svn: 364327
* [cxx2a] P1236R1: the validity of a left shift does not depend on theRichard Smith2019-06-251-1/+2
| | | | | | value of the LHS operand. llvm-svn: 364265
* [CUDA][HIP] Don't set comdat attribute for CUDA device stub ↵Konstantin Pyzhov2019-06-241-0/+5
| | | | | | functions.\nDifferential Revision: https://reviews.llvm.org/D63277 llvm-svn: 364183
* Fix TBAA representation for zero-sized fields and unnamed bit-fields.Richard Smith2019-06-221-0/+4
| | | | | | | | | | | | | | | Unnamed bit-fields should not be represented in the TBAA metadata because they do not represent storage fields (they only affect layout). Zero-sized fields should not be represented in the TBAA metadata because by definition they have no associated storage (so we will never emit a load or store through them), and they might not appear in declaration order within the struct layout. Fixes a verifier failure when emitting a TBAA-enabled load through a class type containing a zero-sized field. llvm-svn: 364140
* Remove reliance on toCharUnitsFromBits rounding down.Richard Smith2019-06-221-1/+2
| | | | llvm-svn: 364139
* Ensure Target Features always_inline error happens in C++ cases.Erich Keane2019-06-214-13/+20
| | | | | | | | A handful of C++ cases as reported in PR42352 didn't actually give an error when always_inlining with a different target feature list. This resulted in broken IR. llvm-svn: 364109
* Devirtualize destructor of final class.Hiroshi Yamauchi2019-06-211-3/+27
| | | | | | | | | | | | | | | | | | | Summary: Take advantage of the final keyword to devirtualize destructor calls. Fix https://bugs.llvm.org/show_bug.cgi?id=21368 Reviewers: rsmith Reviewed By: rsmith Subscribers: davidxl, Prazek, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63161 llvm-svn: 364100
* Rename CodeGenFunction::overlapFor* to getOverlapFor*.Richard Smith2019-06-206-15/+15
| | | | llvm-svn: 363980
* P0840R2: support for [[no_unique_address]] attributeRichard Smith2019-06-206-32/+77
| | | | | | | | | | | | | | | | | Summary: Add support for the C++2a [[no_unique_address]] attribute for targets using the Itanium C++ ABI. This depends on D63371. Reviewers: rjmccall, aaron.ballman Subscribers: dschuff, aheejin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63451 llvm-svn: 363976
* Fix passing structs and AVX vectors through sysv_abiReid Kleckner2019-06-201-8/+18
| | | | | | | | Do this the same way we did it for ms_abi in r324594. Fixes PR36806. llvm-svn: 363973
* [clang][NewPM] Move EntryExitInstrumenterPass to the start of the pipelineLeonard Chan2019-06-201-0/+6
| | | | | | | | | | This fixes CodeGen/x86_64-instrument-functions.c when running under the new pass manager. The pass should go before any other pass to prevent `__cyg_profile_func_enter/exit()` from not being emitted by inlined functions. Differential Revision: https://reviews.llvm.org/D63577 llvm-svn: 363969
* [OpenMP] Add support for handling declare target to clause when unified ↵Gheorghe-Teodor Bercea2019-06-205-36/+76
| | | | | | | | | | | | | | | | | | | | | memory is required Summary: This patch adds support for the handling of the variables under the declare target to clause. The variables in this case are handled like link variables are. A pointer is created on the host and then mapped to the device. The runtime will then copy the address of the host variable in the device pointer. Reviewers: ABataev, AlexEichenberger, caomhin Reviewed By: ABataev Subscribers: guansong, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63108 llvm-svn: 363959
* Store a pointer to the return value in a static alloca and let the debugger ↵Amy Huang2019-06-205-11/+44
| | | | | | | | | | | | | | use that as the variable address for NRVO variables. Subscribers: hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D63361 llvm-svn: 363952
* Revert r363116 "[X86] [ABI] Fix i386 ABI "__m64" type bug"Hans Wennborg2019-06-191-36/+20
| | | | | | | | | | | | | | | | | | | | | This introduced MMX instructions in code that wasn't previously using them, breaking programs using 64-bit vectors and x87 floating-point in the same application. See discussion on the code review for more details. > According to System V i386 ABI: the __m64 type paramater and return > value are passed by MMX registers. But current implementation treats > __m64 as i64 which results in parameter passing by stack and returning > by EDX and EAX. > > This patch fixes the bug (https://bugs.llvm.org/show_bug.cgi?id=41029) > for Linux and NetBSD. > > Patch by Wei Xiao (wxiao3) > > Differential Revision: https://reviews.llvm.org/D59744 llvm-svn: 363790
* [OPENMP][NVPTX]Correct codegen for 128 bit long double.Alexey Bataev2019-06-181-1/+3
| | | | | | If the host uses 128 bit long doubles, the compiler should generate correct code for NVPTX devices. If the return type has 128 bit long doubles, in LLVM IR this type must be coerced to int array instead. llvm-svn: 363720
* [CodeGen][ARM] Fix FP16 vector coercionMikhail Maltsev2019-06-181-3/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When a function argument or return type is a homogeneous aggregate which contains an FP16 vector but the target does not support FP16 operations natively, the type must be converted into an array of integer vectors by then front end (otherwise LLVM will handle FP16 vectors incorrectly by scalarizing them and promoting FP16 to float, see https://reviews.llvm.org/D50507). Currently the logic for checking whether or not a given homogeneous aggregate contains FP16 vectors is incorrect: it only looks at the type of the first vector. This patch fixes the issue by adding a new method ARMABIInfo::containsAnyFP16Vectors and using it. The traversal logic of this method is largely the same as in ABIInfo::isHomogeneousAggregate. Reviewers: eli.friedman, olista01, ostannard Reviewed By: ostannard Subscribers: ostannard, john.brawn, javed.absar, kristof.beyls, pbarrio, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63437 llvm-svn: 363687
* Fix compiler warning by removing unused variableMikael Holmen2019-06-181-1/+1
| | | | llvm-svn: 363651
* Rewrite ConstStructBuilder with a mechanism that can cope with splitting and ↵Richard Smith2019-06-171-495/+636
| | | | | | | | | | | | | | | | | | | | | | | | updating constants. Summary: This adds a ConstantBuilder class that deals with incrementally building an aggregate constant, including support for overwriting previously-emitted parts of the aggregate with new values. This fixes a bunch of cases where we used to be unable to reduce a DesignatedInitUpdateExpr down to an IR constant, and also lays some groundwork for emission of class constants with [[no_unique_address]] members. Reviewers: rjmccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63371 llvm-svn: 363620
* PR42205: DebugInfio: Do not attempt to emit debug info metadata for static ↵David Blaikie2019-06-171-0/+3
| | | | | | | | | | | member variable template partial specializations Would cause a crash in an attempt to create the type for the still unresolved 'auto' in the partial specialization (& even without the use of 'auto', the expression would be value dependent & crash/assertion-fail there). llvm-svn: 363606
* [Remarks] Extend -fsave-optimization-record to specify the formatFrancis Visoiu Mistrih2019-06-172-0/+6
| | | | | | | | | Use -fsave-optimization-record=<format> to specify a different format than the default, which is YAML. For now, only YAML is supported. llvm-svn: 363573
* [clang][CodeGen] Remove std::move on temporaryKadir Cetinkaya2019-06-171-1/+1
| | | | llvm-svn: 363563
* [HIP] Add the interface deriving the stub name of device kernels.Michael Liao2019-06-173-10/+31
| | | | | | | | | | | | | | | | Summary: - Revise the interface to derive the stub name and simplify the assertion of it. Reviewers: yaxunl, tra Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63335 llvm-svn: 363553
OpenPOWER on IntegriCloud