summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [AST] Only store data for the NRVO candidate in ReturnStmt if neededBruno Ricci2018-10-301-3/+4
| | | | | | | | | | | | | Only store the NRVO candidate if needed in ReturnStmt. A good chuck of all of the ReturnStmt have no NRVO candidate (more than half when parsing all of Boost). For all of them this saves one pointer. This has no impact on children(). Differential Revision: https://reviews.llvm.org/D53716 Reviewed By: rsmith llvm-svn: 345605
* [clang] Move two utility functions into SourceManagerRoman Lebedev2018-10-301-12/+2
| | | | | | | | | | | | | | | | Summary: So we can keep that not-so-great logic in one place. Reviewers: rsmith, aaron.ballman Reviewed By: rsmith Subscribers: nemanjai, kbarton, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D53837 llvm-svn: 345594
* [OPENMP] Fix for "error: unused variable 'CED'"Bjorn Pettersson2018-10-301-1/+1
| | | | | | Quick fix to make code compile with -Werror,-Wunused-variable. llvm-svn: 345573
* PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of typeRichard Smith2018-10-302-3/+4
| | | | | | | | | nullptr_t does not access memory. We now reuse CK_NullToPointer to represent a conversion from a glvalue of type nullptr_t to a prvalue of nullptr_t where necessary. llvm-svn: 345562
* In swiftcall, don't merge FP/vector types within a chunk.John McCall2018-10-291-3/+37
| | | | llvm-svn: 345536
* [OpenMP][NVPTX] Use single loops when generating code for distribute ↵Gheorghe-Teodor Bercea2018-10-295-33/+122
| | | | | | | | | | | | | | | | parallel for Summary: This patch adds a new code generation path for bound sharing directives containing distribute parallel for. The new code generation scheme applies to chunked schedules on distribute and parallel for directives. The scheme simplifies the code that is being generated by eliminating the need for an outer for loop over chunks for both distribute and parallel for directives. In the case of distribute it applies to any sized chunk while in the parallel for case it only applies when chunk size is 1. Reviewers: ABataev, caomhin Reviewed By: ABataev Subscribers: jholewinski, guansong, cfe-commits Differential Revision: https://reviews.llvm.org/D53448 llvm-svn: 345509
* [OpenMP][NVPTX] Enable default scheduling for parallel for in non-SPMD cases.Gheorghe-Teodor Bercea2018-10-291-5/+6
| | | | | | | | | | | | | | Summary: This patch enables the choosing of the default schedule for parallel for loops even in non-SPMD cases. Reviewers: ABataev, caomhin Reviewed By: ABataev Subscribers: jholewinski, guansong, cfe-commits Differential Revision: https://reviews.llvm.org/D53443 llvm-svn: 345507
* [OPENMP] Do not capture private loop counters.Alexey Bataev2018-10-291-2/+9
| | | | | | | | If the loop counter is not declared in the context of the loop and it is private, such loop counters should not be captured in the outlined regions. llvm-svn: 345505
* [AST] Refactor PredefinedExprBruno Ricci2018-10-272-2/+2
| | | | | | | | | | | | | | | | | | Make the following changes to PredefinedExpr: 1. Move PredefinedExpr below StringLiteral so that it can use its definition. 2. Rename IdentType to IdentKind to be more in line with clang's conventions, and propagate the change to its users. 3. Move the location and the IdentKind into the newly available space of the bit-fields of Stmt. 4. Only store the function name when needed. When parsing all of Boost, of the 1357 PredefinedExpr 919 have no function name. Differential Revision: https://reviews.llvm.org/D53605 Reviewed By: rjmccall llvm-svn: 345460
* Revert "[PassManager/Sanitizer] Enable usage of ported AddressSanitizer ↵Leonard Chan2018-10-261-11/+0
| | | | | | | | | | | | | passes with -fsanitize=address" This reverts commit 8d6af840396f2da2e4ed6aab669214ae25443204 and commit b78d19c287b6e4a9abc9fb0545de9a3106d38d3d which causes slower build times by initializing the AddressSanitizer on every function run. The corresponding revisions are https://reviews.llvm.org/D52814 and https://reviews.llvm.org/D52739. llvm-svn: 345433
* [Fixed Point Arithmetic] Refactor fixed point castsBjorn Pettersson2018-10-261-55/+38
| | | | | | | | | | | | | | | | | | | | Summary: - Added names for some emitted values (such as "tobool" for the result of a cast to boolean). - Replaced explicit IRBuilder request for doing sext/zext/trunc by using CreateIntCast instead. - Simplify code for emitting satuation into one if-statement for clamping to max, and one if-statement for clamping to min. Reviewers: leonardchan, ebevhan Reviewed By: leonardchan Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53707 llvm-svn: 345398
* PR31978: Don't crash if CodeGen sees a top-level BindingDecl.Richard Smith2018-10-261-0/+1
| | | | llvm-svn: 345362
* CodeGen: correct the case for swift 4.2, 5.0Saleem Abdulrasool2018-10-261-4/+4
| | | | | | | This corrects the leader for the swift names. The encoding for 4.2 and 5.0 differ by a single bit on the second character and were swapped. llvm-svn: 345360
* [AArch64] Support Windows stack probe command-line arguments.Eli Friedman2018-10-261-0/+11
| | | | | | | | | | | Adds support for -mno-stack-arg-probe and -mstack-probe-size. (Not really happy copy-pasting code, but that's what we do for all the other Windows targets.) Differential Revision: https://reviews.llvm.org/D53617 llvm-svn: 345354
* [AArch64] Implement FP16FML intrinsicsBryan Chan2018-10-251-0/+36
| | | | | | | | | | | | | Generate the FP16FML intrinsics into arm_neon.h (AArch64 only for now). Add two new type modifiers to NeonEmitter to handle the new prototypes. Define __ARM_FEATURE_FP16FML when +fp16fml is enabled and guard the intrinsics with the macro in arm_neon.h. Based on a patch by Gao Yiling. Differential Revision: https://reviews.llvm.org/D53633 llvm-svn: 345344
* Change keep-static-consts to work on static storage duration, notErich Keane2018-10-251-2/+3
| | | | | | | | | | storage class. To be more in line with what GCC does, switch the condition to be based on the Static Storage duration instead of the storage class. Change-Id: I8e959d762433cda48855099353bf3c950b9d54b8 llvm-svn: 345302
* [WebAssembly] Bitselect and min/max builtinsThomas Lively2018-10-251-0/+28
| | | | | | | | | | Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits Differential Revision: https://reviews.llvm.org/D53685 llvm-svn: 345301
* [WebAssembly] Lower to target-independent saturating addThomas Lively2018-10-251-2/+2
| | | | | | | | | | | | Summary: Goes along with D53721. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits Differential Revision: https://reviews.llvm.org/D53722 llvm-svn: 345300
* Implement Function Multiversioning for Non-ELF Systems.Erich Keane2018-10-254-40/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | Similar to how ICC handles CPU-Dispatch on Windows, this patch uses the resolver function directly to forward the call to the proper function. This is not nearly as efficient as IFuncs of course, but is still quite useful for large functions specifically developed for certain processors. This is unfortunately still limited to x86, since it depends on __builtin_cpu_supports and __builtin_cpu_is, which are x86 builtins. The naming for the resolver/forwarding function for cpu-dispatch was taken from ICC's implementation, which uses the unmodified name for this (no mangling additions). This is possible, since cpu-dispatch uses '.A' for the 'default' version. In 'target' multiversioning, this function keeps the '.resolver' extension in order to keep the default function keeping the default mangling. Change-Id: I4731555a39be26c7ad59a2d8fda6fa1a50f73284 Differential Revision: https://reviews.llvm.org/D53586 llvm-svn: 345298
* CodeGen: alter CFConstantString class name for swift 5.0Saleem Abdulrasool2018-10-251-1/+6
| | | | | | | Swift 5.0 has changed the name decoration for swift symbols, using a 'S' sigil rather than 's' as in 4.2. Adopt the new convention. llvm-svn: 345291
* [AArch64] Branch Protection and Return Address Signing B Key SupportLuke Cheeseman2018-10-252-7/+25
| | | | | | | | | | | - Add support for -mbranch-protection=<type>[+<type>]* where - <type> ::= [standard, none, bti, pac-ret[+b-key,+leaf]*] - The protection emits relevant function attributes - sign-return-address=<scope> - sign-return-address-key=<key> - branch-protection llvm-svn: 345273
* [CodeGen] Always emit the 'min-legal-vector-width' attribute even when the ↵Craig Topper2018-10-251-3/+1
| | | | | | | | value is 0. The X86 backend will need to see the attribute to make decisions. If it isn't present the backend will have to assume large vectors may be present. llvm-svn: 345237
* Driver,CodeGen: introduce support for Swift CFString layoutSaleem Abdulrasool2018-10-241-6/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new driver level flag `-fcf-runtime-abi=` that allows one to specify the runtime ABI for CoreFoundation. This controls the language interoperability. In particular, this is relevant for generating the CFConstantString classes (primarily through the `__builtin___CFStringMakeConstantString` builtin) which construct a reference to the "CFObject"'s `isa` field. This type differs between swift 4.1 and 4.2+. Valid values for the new option include: - objc [default behaviour] - enable ObjectiveC interoperability - swift-4.1 - enable interoperability with swift 4.1 - swift-4.2 - enable interoperability with swift 4.2 - swift-5.0 - enable interoperability with swift 5.0 - swift [alias] - target the latest swift ABI Furthermore, swift 4.2+ changed the layout for the CFString when building CoreFoundation *without* ObjectiveC interoperability. In such a case, a field was added to the CFObject base type changing it from: <{ const int*, int }> to <{ uintptr_t, uintptr_t, uint64_t }>. In swift 5.0, the CFString type will be further adjusted to change the length from a uint32_t on everything but BE LP64 targets to uint64_t. Note that the default behaviour for clang remains unchanged and the new layout must be explicitly opted into via `-fcf-runtime-abi=swift*`. llvm-svn: 345222
* Do not always request an implicit taskgroup region inside the kmpc_taskloop ↵Alexey Bataev2018-10-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function Summary: For the following code: ``` int i; #pragma omp taskloop for (i = 0; i < 100; ++i) {} #pragma omp taskloop nogroup for (i = 0; i < 100; ++i) {} ``` Clang emits the following LLVM IR: ``` ... call void @__kmpc_taskgroup(%struct.ident_t* @0, i32 %0) %2 = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @0, i32 %0, i32 1, i64 80, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* @.omp_task_entry. to i32 (i32, i8*)*)) ... call void @__kmpc_taskloop(%struct.ident_t* @0, i32 %0, i8* %2, i32 1, i64* %8, i64* %9, i64 %13, i32 0, i32 0, i64 0, i8* null) call void @__kmpc_end_taskgroup(%struct.ident_t* @0, i32 %0) ... %15 = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @0, i32 %0, i32 1, i64 80, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates.1*)* @.omp_task_entry..2 to i32 (i32, i8*)*)) ... call void @__kmpc_taskloop(%struct.ident_t* @0, i32 %0, i8* %15, i32 1, i64* %21, i64* %22, i64 %26, i32 0, i32 0, i64 0, i8* null) ``` The first set of instructions corresponds to the first taskloop construct. It is important to note that the implicit taskgroup region associated with the taskloop construct has been materialized in our IR: the `__kmpc_taskloop` occurs inside a taskgroup region. Note also that this taskgroup region does not exist in our second taskloop because we are using the `nogroup` clause. The issue here is the 4th argument of the kmpc_taskloop call, starting from the end, is always a zero. Checking the LLVM OpenMP RT implementation, we see that this argument corresponds to the nogroup parameter: ``` void __kmpc_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val, kmp_uint64 *lb, kmp_uint64 *ub, kmp_int64 st, int nogroup, int sched, kmp_uint64 grainsize, void *task_dup); ``` So basically we always tell to the RT to do another taskgroup region. For the first taskloop, this means that we create two taskgroup regions. For the second example, it means that despite the fact we had a nogroup clause we are going to have a taskgroup region, so we unnecessary wait until all descendant tasks have been executed. Reviewers: ABataev Reviewed By: ABataev Subscribers: rogfer01, cfe-commits Differential Revision: https://reviews.llvm.org/D53636 llvm-svn: 345180
* [CodeGen] Update min-legal-vector width based on function argument and ↵Craig Topper2018-10-242-1/+30
| | | | | | | | | | | | return types This is a continuation of my patches to inform the X86 backend about what the largest IR types are in the function so that we can restrict the backend type legalizer to prevent 512-bit vectors on SKX when -mprefer-vector-width=256 is specified if no explicit 512 bit vectors were specified by the user. This patch updates the vector width based on the argument and return types of the current function and from the types of any functions it calls. This is intended to make sure the backend type legalizer doesn't disturb any types that are required for ABI. Differential Revision: https://reviews.llvm.org/D52441 llvm-svn: 345168
* CodeGen: extract some local variables in CFConstantString creation (NFC)Saleem Abdulrasool2018-10-241-19/+18
| | | | | | | Extract the reference to the ASTContext and Triple and use them throughout the function. This is simply a cosmetic cleanup while in the area. NFC. llvm-svn: 345160
* Remove a pair of unused dispatch multiversion declarations.Erich Keane2018-10-241-15/+0
| | | | | | | | | These declarations somehow survived a cleanup that combined them with the target multiversioning functions. This patch removes them as they are no longer necessary or used. Change-Id: I318286401ace63bef1aa48018dabb25be0117ca0 llvm-svn: 345145
* Debug Info (-gmodules): emit full types for non-anchored template ↵Adrian Prantl2018-10-241-0/+9
| | | | | | | | | | | | | | | | | specializations Before this patch, clang would emit a (module-)forward declaration for template instantiations that are not anchored by an explicit template instantiation, but still are guaranteed to be available in an imported module. Unfortunately detecting the owning module doesn't reliably work when local submodule visibility is enabled and the template is inside a cross-module namespace. This make clang debuggable again with -gmodules and LSV enabled. rdar://problem/41552377 llvm-svn: 345109
* [Fixed Point Arithmetic] Fixed Point to Boolean CastLeonard Chan2018-10-235-5/+33
| | | | | | | | | | This patch is a part of https://reviews.llvm.org/D48456 in an attempt to split the casting logic up into smaller patches. This contains the code for casting from fixed point types to boolean types. Differential Revision: https://reviews.llvm.org/D53308 llvm-svn: 345063
* [OpenCL][NFC] Unify ZeroToOCL* cast typesAndrew Savonichev2018-10-235-17/+8
| | | | | | | | | | | | Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: asavonic, cfe-commits Differential Revision: https://reviews.llvm.org/D52654 llvm-svn: 345038
* Revert r345009 "[DebugInfo] Generate debug information for labels. (After ↵Hans Wennborg2018-10-233-39/+0
| | | | | | | | | | | | | | | | | | | | | fix PR39094)" This broke the Chromium build. See https://bugs.chromium.org/p/chromium/issues/detail?id=898152#c1 for the reproducer. > Generate DILabel metadata and call llvm.dbg.label after label > statement to associate the metadata with the label. > > After fixing PR37395. > After fixing problems in LiveDebugVariables. > After fixing NULL symbol problems in AddressPool when enabling > split-dwarf-file. > After fixing PR39094. > > Differential Revision: https://reviews.llvm.org/D45045 llvm-svn: 345026
* [DebugInfo] Generate debug information for labels. (After fix PR39094)Hsiangkai Wang2018-10-233-0/+39
| | | | | | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. After fixing PR37395. After fixing problems in LiveDebugVariables. After fixing NULL symbol problems in AddressPool when enabling split-dwarf-file. After fixing PR39094. Differential Revision: https://reviews.llvm.org/D45045 llvm-svn: 345009
* [CodeGen] Attach InlineHint to more functionsRichard Trieu2018-10-231-3/+13
| | | | | | | For instantiated functions, search the template pattern to see if it marked inline to determine if InlineHint attribute should be added to the function. llvm-svn: 344987
* Revert "Ensure sanitizer check function calls have a !dbg location"Vlad Tsyrklevich2018-10-221-3/+0
| | | | | | | This reverts commit r344915. It was causing exceptions on the x86_64-linux-ubsan bot. llvm-svn: 344961
* Give Multiversion-inline functions linkonce linkageErich Keane2018-10-221-0/+4
| | | | | | | | | | | | Since multiversion variant functions can be inline, in C they become available-externally linkage. This ends up causing the variants to not be emitted, and not available to the linker. The solution is to make sure that multiversion functions are always emitted by marking them linkonce. Change-Id: I897aa37c7cbba0c1eb2c57ee881d5000a2113b75 llvm-svn: 344957
* Ensure sanitizer check function calls have a !dbg locationAdrian Prantl2018-10-221-0/+3
| | | | | | | | | | | | | | | | | Function calls without a !dbg location inside a function that has a DISubprogram make it impossible to construct inline information and are rejected by the verifier. This patch ensures that sanitizer check function calls have a !dbg location, by carrying forward the location of the preceding instruction or by inserting an artificial location if necessary. This fixes a crash when compiling the attached testcase with -Os. rdar://problem/45311226 Differential Revision: https://reviews.llvm.org/D53459 llvm-svn: 344915
* Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFCFangrui Song2018-10-202-10/+9
| | | | llvm-svn: 344859
* [CodeGen] Use the mangle context owned by CodeGenModule to correctlyAkira Hatanaka2018-10-201-3/+1
| | | | | | | | | | | | | | | mangle types of lambda objects captured by a block instead of creating a new mangle context everytime a captured field type is mangled. This fixes a bug in IRGen's block helper merging code that was introduced in r339438 where two blocks capturing two distinct lambdas would end up sharing helper functions and the block descriptor. This happened because the ID number used to distinguish lambdas defined in the same context is reset everytime a mangled context is created. rdar://problem/45314494 llvm-svn: 344833
* [X86] Add support for more than 32 features for __builtin_cpu_isCraig Topper2018-10-202-29/+52
| | | | | | | | | | | | | | libgcc supports more than 32 features by adding a new 32-bit variable __cpu_features2. This adds the clang support for checking these feature bits. Patches for compiler-rt and llvm to support this are coming as well. Probably still need an additional patch for target multiversioning in clang. Differential Revision: https://reviews.llvm.org/D53458 llvm-svn: 344832
* [X86] When checking the bits in cpu_features for function multiversioning ↵Craig Topper2018-10-201-3/+3
| | | | | | | | | | | | | | | | | | | dispatcher in the resolver, make sure all the required bits are set. Not just one of them Summary: The multiversioning code repurposed the code from __builtin_cpu_supports for checking if a single feature is enabled. That code essentially performed (_cpu_features & (1 << C)) != 0. But with the multiversioning path, the mask is no longer guaranteed to be a power of 2. So we return true anytime any one of the bits in the mask is set not just all of the bits. The correct check is (_cpu_features & mask) == mask Reviewers: erichkeane, echristo Reviewed By: echristo Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53460 llvm-svn: 344824
* PR24164, PR39336: init-captures are not distinct full-expressions.Richard Smith2018-10-191-1/+0
| | | | | | | | | Rather, they are subexpressions of the enclosing lambda-expression, and any temporaries in them are destroyed at the end of that full-expression, or when the corresponding lambda-expression is destroyed if they are lifetime-extended. llvm-svn: 344801
* [COFF, ARM64] Add _ReadStatusReg and_WriteStatusReg intrinsicsMandeep Singh Grang2018-10-181-0/+37
| | | | | | | | | | | | Reviewers: rnk, compnerd, mstorsjo, efriedma, TomTan, haripul, javed.absar Reviewed By: efriedma Subscribers: dmajor, kristof.beyls, chrib, cfe-commits Differential Revision: https://reviews.llvm.org/D53115 llvm-svn: 344765
* Add support for -mno-tls-direct-seg-refs to ClangKristina Brooks2018-10-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch exposes functionality added in rL344723 to the Clang driver/frontend as a flag and adds appropriate metadata. Driver tests pass: ``` ninja check-clang-driver -snip- Expected Passes : 472 Expected Failures : 3 Unsupported Tests : 65 ``` Odd failure in CodeGen tests but unrelated to this: ``` ninja check-clang-codegen -snip- /SourceCache/llvm-trunk-8.0/tools/clang/test/CodeGen/builtins-wasm.c:87:10: error: cannot compile this builtin function yet -snip- Failing Tests (1): Clang :: CodeGen/builtins-wasm.c Expected Passes : 1250 Expected Failures : 2 Unsupported Tests : 120 Unexpected Failures: 1 ``` Original commit: [X86] Support for the mno-tls-direct-seg-refs flag Allows to disable direct TLS segment access (%fs or %gs). GCC supports a similar flag, it can be useful in some circumstances, e.g. when a thread context block needs to be updated directly from user space. More info and specific use cases: https://bugs.llvm.org/show_bug.cgi?id=16145 Patch by nruslan (Ruslan Nikolaev). Differential Revision: https://reviews.llvm.org/D53102 llvm-svn: 344739
* [TI removal] Test predicate rather than casting to detect a terminatorChandler Carruth2018-10-181-4/+5
| | | | | | and use the range based successor API. llvm-svn: 344730
* [PassManager/Sanitizer] Enable usage of ported AddressSanitizer passes with ↵Leonard Chan2018-10-171-0/+11
| | | | | | | | | | | | | -fsanitize=address Enable usage of `AddressSanitizer` and `AddressModuleSanitizer` ported from the legacy to the new PassManager. This patch depends on https://reviews.llvm.org/D52739. Differential Revision: https://reviews.llvm.org/D52814 llvm-svn: 344699
* NFC: Remove trailing space from CodeGenModule.cppTakuto Ikuta2018-10-171-8/+8
| | | | llvm-svn: 344668
* AMDGPU: add __builtin_amdgcn_update_dppYaxun Liu2018-10-171-5/+9
| | | | | | | | | | Emit llvm.amdgcn.update.dpp for both __builtin_amdgcn_mov_dpp and __builtin_amdgcn_update_dpp. The first argument to llvm.amdgcn.update.dpp will be undef for __builtin_amdgcn_mov_dpp. Differential Revision: https://reviews.llvm.org/D52320 llvm-svn: 344665
* [OPENMP][NVPTX]Increment iterator only when it is used, NFC.Alexey Bataev2018-10-161-1/+2
| | | | llvm-svn: 344574
* [Fixed Point Arithmetic] FixedPointCastLeonard Chan2018-10-155-2/+113
| | | | | | | | | | | | | This patch is a part of https://reviews.llvm.org/D48456 in an attempt to split them up. This contains the code for casting between fixed point types and other fixed point types. The method for converting between fixed point types is based off the convert() method in APFixedPoint. Differential Revision: https://reviews.llvm.org/D50616 llvm-svn: 344530
* Revert "[CodeGenCXX] Treat 'this' as noalias in constructors"Sean Fertile2018-10-151-16/+0
| | | | | | | This reverts commit https://reviews.llvm.org/rL344150 which causes MachineOutliner related failures on the ppc64le multistage buildbot. llvm-svn: 344526
OpenPOWER on IntegriCloud