summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* ANSIfy. No behavior change.Nico Weber2017-05-051-1/+1
| | | | llvm-svn: 302258
* Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in ↵Peter Collingbourne2017-05-041-2/+6
| | | | | | | | the module summary. NFCI." with a fix for the clang backend. llvm-svn: 302176
* Revert "IR: Use pointers instead of GUIDs to represent edges in the module ↵Eric Liu2017-05-041-2/+2
| | | | | | | | summary. NFCI." This reverts commit r302108. llvm-svn: 302141
* [OpenCL] Add intel_reqd_sub_group_size attribute supportXiuli Pan2017-05-042-22/+22
| | | | | | | | | | | | | | | | Summary: Add intel_reqd_sub_group_size attribute support as intel extension cl_intel_required_subgroup_size from https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_required_subgroup_size.txt Reviewers: Anastasia, bader, hfinkel, pxli168 Reviewed By: Anastasia, bader, pxli168 Subscribers: cfe-commits, yaxunl Differential Revision: https://reviews.llvm.org/D30805 llvm-svn: 302125
* IR: Use pointers instead of GUIDs to represent edges in the module summary. ↵Peter Collingbourne2017-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | NFCI. When profiling a no-op incremental link of Chromium I found that the functions computeImportForFunction and computeDeadSymbols were consuming roughly 10% of the profile. The goal of this change is to improve the performance of those functions by changing the map lookups that they were previously doing into pointer dereferences. This is achieved by changing the ValueInfo data structure to be a pointer to an element of the global value map owned by ModuleSummaryIndex, and changing reference lists in the GlobalValueSummary to hold ValueInfos instead of GUIDs. This means that a ValueInfo will take a client directly to the summary list for a given GUID. Differential Revision: https://reviews.llvm.org/D32471 llvm-svn: 302108
* [IR] Abstract away ArgNo+1 attribute indexing as much as possibleReid Kleckner2017-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Do three things to help with that: - Add AttributeList::FirstArgIndex, which is an enumerator currently set to 1. It allows us to change the indexing scheme with fewer changes. - Add addParamAttr/removeParamAttr. This just shortens addAttribute call sites that would otherwise need to spell out FirstArgIndex. - Remove some attribute-specific getters and setters from Function that take attribute list indices. Most of these were only used from BuildLibCalls, and doesNotAlias was only used to test or set if the return value is malloc-like. I'm happy to split the patch, but I think they are probably easier to review when taken together. This patch should be NFC, but it sets the stage to change the indexing scheme to this, which is more convenient when indexing into an array: 0: func attrs 1: retattrs 2...: arg attrs Reviewers: chandlerc, pete, javed.absar Subscribers: david2050, llvm-commits Differential Revision: https://reviews.llvm.org/D32811 llvm-svn: 302060
* [ubsan] Skip overflow checks on safe arithmetic (fixes PR32874)Vedant Kumar2017-05-021-8/+78
| | | | | | | | | | | | | | | | | | | | | | | | Currently, ubsan emits overflow checks for arithmetic that is known to be safe at compile-time, e.g: 1 + 1 => CheckedAdd(1, 1) This leads to breakage when using the __builtin_prefetch intrinsic. LLVM expects the arguments to @llvm.prefetch to be constant integers, and when ubsan inserts unnecessary checks on the operands to the intrinsic, this contract is broken, leading to verifier failures (see PR32874). Instead of special-casing __builtin_prefetch for ubsan, this patch fixes the underlying problem, i.e that clang currently emits unnecessary overflow checks. Testing: I ran the check-clang and check-ubsan targets with a stage2, ubsan-enabled build of clang. I added a regression test for PR32874, and some extra checking to make sure we don't regress runtime checking for unsafe arithmetic. The existing ubsan-promoted-arithmetic.cpp test also provides coverage for this change. llvm-svn: 301988
* Re-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of ↵Reid Kleckner2017-05-023-21/+6
| | | | | | | | | | AttributeList" This time, I fixed, built, and tested clang. This reverts r301712. llvm-svn: 301981
* Object: Remove ModuleSummaryIndexObjectFile class.Peter Collingbourne2017-05-011-1/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D32195 llvm-svn: 301832
* Adapt to LLVM's rename of WeakVH to WeakTrackingVH; NFCSanjoy Das2017-05-015-12/+14
| | | | llvm-svn: 301815
* Remove unneeded struct; NFCSanjoy Das2017-05-012-20/+12
| | | | | | | | | | | | | | Summary: Unless I'm missing something, the DeferredGlobal struct's GV field is unused, removing which makes the struct itself trivial. Reviewers: rafael, chandlerc Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D32691 llvm-svn: 301789
* Adapt to LLVM API change (DINamespace no longer takes line/file info).Adrian Prantl2017-04-281-4/+2
| | | | | | | rdar://problem/17484998 https://reviews.llvm.org/D32648 llvm-svn: 301707
* [CodeGen][ObjC] Don't retain captured Objective-C pointers at blockAkira Hatanaka2017-04-283-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | creation that are const-qualified. When a block captures an ObjC object pointer, clang retains the pointer to prevent prematurely destroying the object the pointer points to before the block is called or copied. When the captured object pointer is const-qualified, we can avoid emitting the retain/release pair since the pointer variable cannot be modified in the scope in which the block literal is introduced. For example: void test(const id x) { callee(^{ (void)x; }); } This patch implements that optimization. rdar://problem/28894510 Differential Revision: https://reviews.llvm.org/D32601 llvm-svn: 301667
* [Profile] Add off-by-default -Wprofile-instr-missing warningVedant Kumar2017-04-271-3/+7
| | | | | | | | | | | | | | | Clang warns that a profile is out-of-date if it can't find a profile record for any function in a TU. This warning became noisy after llvm started allowing dead-stripping of instrumented functions. To fix this, this patch changes the existing profile out-of-date warning (-Wprofile-instr-out-of-date) so that it only complains about mismatched data. Further, it introduces a new, off-by-default warning about missing function data (-Wprofile-instr-missing). Differential Revision: https://reviews.llvm.org/D28867 llvm-svn: 301570
* Fix -Wpedantic about extra semicolons in CGStmtOpenMP.cppHans Wennborg2017-04-271-3/+3
| | | | llvm-svn: 301564
* [X86] Support of no_caller_saved_registers attributeOren Ben Simhon2017-04-271-0/+3
| | | | | | | | | Implements the Clang part for no_caller_saved_registers attribute as appears here: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5ed3cc7b66af4758f7849ed6f65f4365be8223be. Differential Revision: https://reviews.llvm.org/D31871 llvm-svn: 301535
* [ubsan] nullability-assign: Check assignments into C++ structsVedant Kumar2017-04-261-0/+2
| | | | | | | | | | Fix the nullability-assign check so that it can handle assignments into C++ structs. Previously, such assignments were not instrumented. Testing: check-clang, check-ubsan, enabling the existing test in ObjC++ mode, and building some Apple frameworks with -fsanitize=nullability. llvm-svn: 301482
* Fix API breaksDavid Blaikie2017-04-262-3/+4
| | | | llvm-svn: 301470
* Refactor frontend InputKind to prepare for treating module maps as a ↵Richard Smith2017-04-261-1/+1
| | | | | | | | distinct kind of input. No functionality change intended. llvm-svn: 301442
* Revert "Update to LLVM's use of WeakTrackingVH; NFC"Sanjoy Das2017-04-265-14/+12
| | | | | | This reverts commit r301427. llvm-svn: 301430
* Update to LLVM's use of WeakTrackingVH; NFCSanjoy Das2017-04-265-12/+14
| | | | | | | | | | | | Summary: Depends on D32266 Reviewers: davide, dblaikie Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D32270 llvm-svn: 301427
* [ubsan] Skip alignment checks on allocas with known alignmentVedant Kumar2017-04-261-12/+9
| | | | | | | | | | | | | | | | | | | | It's possible to determine the alignment of an alloca at compile-time. Use this information to skip emitting some runtime alignment checks. Testing: check-clang, check-ubsan. This significantly reduces the amount of alignment checks we emit when compiling X86ISelLowering.cpp. Here are the numbers from patched/unpatched clangs based on r301361. ------------------------------------------ | Setup | # of alignment checks | ------------------------------------------ | unpatched, -O0 | 47195 | | patched, -O0 | 30876 | (-34.6%) ------------------------------------------ llvm-svn: 301377
* [asan] Unconditionally enable GC of globals on COFF.Evgeniy Stepanov2017-04-261-2/+1
| | | | | | | | | | | This change restores pre-r301225 behavior, where linker GC compatible global instrumentation was used on COFF targets disregarding -f(no-)data-sections and/or /Gw flags. This instrumentation puts each global in a COMDAT with an ASan descriptor for that global. It effectively enables -fdata-sections, but limits it to ASan-instrumented globals. llvm-svn: 301374
* Recommit ofCarlo Bertolli2017-04-254-123/+471
| | | | | | | | | | | | | | [OpenMP] Initial implementation of code generation for pragma 'distribute parallel for' on host https://reviews.llvm.org/D29508 This patch makes the following additions: It abstracts away loop bound generation code from procedures associated with pragma 'for' and loops in general, in such a way that the same procedures can be used for 'distribute parallel for' without the need for a full re-implementation. It implements code generation for 'distribute parallel for' and adds regression tests. It includes tests for clauses. It is important to notice that most of the clauses are implemented as part of existing procedures. For instance, firstprivate is already implemented for 'distribute' and 'for' as separate pragmas. As the implementation of 'distribute parallel for' is based on the same procedures, then we automatically obtain implementation for such clauses without the need to add new code. However, this requires regression tests that verify correctness of produced code. llvm-svn: 301340
* Remove a dead field. NFC.Vedant Kumar2017-04-242-8/+2
| | | | | | Suggested by Adam Folwarczny! llvm-svn: 301250
* [Coverage] Avoid null deref in skipRegionMappingForDecl (fixes PR32761)Vedant Kumar2017-04-241-0/+3
| | | | | | | | Patch by Adam Folwarczny! Differential Revision: https://reviews.llvm.org/D32406 llvm-svn: 301249
* Revert r301223Carlo Bertolli2017-04-244-471/+123
| | | | llvm-svn: 301233
* [asan] Disable ASan global-GC depending on the target and compiler flags.Evgeniy Stepanov2017-04-241-6/+30
| | | | llvm-svn: 301225
* [OpenMP] Initial implementation of code generation for pragma 'distribute ↵Carlo Bertolli2017-04-244-123/+471
| | | | | | | | | | | | | | | | | parallel for' on host https://reviews.llvm.org/D29508 This patch makes the following additions: 1. It abstracts away loop bound generation code from procedures associated with pragma 'for' and loops in general, in such a way that the same procedures can be used for 'distribute parallel for' without the need for a full re-implementation. 2. It implements code generation for 'distribute parallel for' and adds regression tests. It includes tests for clauses. It is important to notice that most of the clauses are implemented as part of existing procedures. For instance, firstprivate is already implemented for 'distribute' and 'for' as separate pragmas. As the implementation of 'distribute parallel for' is based on the same procedures, then we automatically obtain implementation for such clauses without the need to add new code. However, this requires regression tests that verify correctness of produced code. Looking forward to comments. llvm-svn: 301223
* [Devirtualization] Emit invariant.group loads with empty group mdPiotr Padlewski2017-04-241-6/+2
| | | | | | | | | | | | | | | Summary: As discussed here http://lists.llvm.org/pipermail/llvm-dev/2017-January/109332.html having different groups doesn't solve the problem entirly. Reviewers: rjmccall, rsmith Subscribers: amharc, cfe-commits Differential Revision: https://reviews.llvm.org/D32110 llvm-svn: 301178
* Move Split DWARF handling to an MC option/command line argument rather than ↵David Blaikie2017-04-212-5/+9
| | | | | | | | | | | | | | | | | | | using metadata Since Split DWARF needs to name the actual .dwo file that is generated, it can't be known at the time the llvm::Module is produced as it may be merged with other Modules before the object is generated and that object may be generated with any name. By passing the Split DWARF file name when LLVM is producing object code the .dwo file name in the object file can match correctly. The support for Split DWARF for implicit modules remains the same - using metadata to store the dwo name and dwo id so that potentially multiple skeleton CUs referring to different dwo files can be generated from one llvm::Module. llvm-svn: 301063
* Don't pass FPOpFusion::Strict to the backendAdam Nemet2017-04-201-1/+3
| | | | | | | | | | | | | | | This restores the behavior prior to D31167 where the code-gen default was FPC_On which mapped to FPOpFusion::Standard. After merging the FE state (on/off) and the code-gen state (on/fast/off), the default became off to match the front-end. In other words, the front-end controls when to fuse along the language standards and the backend shouldn't override this by splitting fused intrinsics as FPOpFusion::Strict would imply. Differential Revision: https://reviews.llvm.org/D32301 llvm-svn: 300858
* Fix assertion failure in codegen on non-template deduction guide.Richard Smith2017-04-191-0/+4
| | | | llvm-svn: 300762
* [CodeGen] Use preincrement version of APInt::operator++ instead of ↵Craig Topper2017-04-191-1/+1
| | | | | | | | postincrement to avoid creating and immediately discarding a temporary APInt. This is preparation for a clang change to improve the [[nodiscard]] warning to not be ignored on methods that return a class marked [[nodiscard]] that are defined in the class itself. See D32207. llvm-svn: 300756
* Parse backend options during thinlto backend compile actionsDavid Blaikie2017-04-191-6/+5
| | | | llvm-svn: 300741
* [Coverage] Don't emit mappings for functions in dependent contexts (fixes ↵Vedant Kumar2017-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | PR32679) The coverage implementation marks functions which won't be emitted as 'deferred', so that it can emit empty coverage regions for them later (once their linkages are known). Functions in dependent contexts are an exception: if there isn't a full instantiation of a function, it shouldn't be marked 'deferred'. We've been breaking that rule without much consequence because we just ended up with useless, extra, empty coverage mappings. With PR32679, this behavior finally caused a crash, because clang marked a partial template specialization as 'deferred', causing the MS mangler to choke in its delayed-template-parsing mode: error: cannot mangle this template type parameter type yet (http://bugs.llvm.org/show_bug.cgi?id=32679) Fix this by checking if a decl's context is a dependent context before marking it 'deferred'. Based on a patch by Adam Folwarczny! Differential Revision: https://reviews.llvm.org/D32144 llvm-svn: 300723
* Prefer addAttr(Attribute::AttrKind) over the AttributeList overloadReid Kleckner2017-04-192-17/+7
| | | | | | | | This should simplify the call sites, which typically want to tweak one attribute at a time. It should also avoid creating ephemeral AttributeLists that live forever. llvm-svn: 300718
* [CodeGen] Use APInt::lshrInPlace instead of APInt::lshr. NFCCraig Topper2017-04-191-3/+3
| | | | llvm-svn: 300658
* Use less temporary AttributeLists NFCReid Kleckner2017-04-185-51/+33
| | | | llvm-svn: 300628
* Debug Info: Remove special-casing of indirect function argument handling.Adrian Prantl2017-04-181-28/+11
| | | | | | | | | | | | LLVM has changed the semantics of dbg.declare for describing function arguments. After this patch a dbg.declare always takes the *address* of a variable as the first argument, even if the argument is not an alloca. https://bugs.llvm.org/show_bug.cgi?id=32382 rdar://problem/31205000 llvm-svn: 300523
* [ubsan] Skip null checks if they are constant-folded awayVedant Kumar2017-04-171-9/+17
| | | | | | | | | | | | | | | | | | | | | The IR builder can constant-fold null checks if the pointer operand points to a constant. If the "is-non-null" check is folded away to "true", don't emit the null check + branch. Testing: check-clang, check-ubsan. This slightly reduces the amount of null checks we emit when compiling X86ISelLowering.cpp. Here are the numbers from patched/unpatched clangs based on r300371. ------------------------------------- | Setup | # of null checks | ------------------------------------- | unpatched, -O0 | 25251 | | patched, -O0 | 23925 | (-5.3%) ------------------------------------- llvm-svn: 300509
* [ubsan] Skip null checks on pointers to the start of an allocaVedant Kumar2017-04-171-1/+11
| | | | | | | | | | | | | | | | | | | | Pointers to the start of an alloca are non-null, so we don't need to emit runtime null checks for them. Testing: check-clang, check-ubsan. This significantly reduces the amount of null checks we emit when compiling X86ISelLowering.cpp. Here are the numbers from patched / unpatched clangs based on r300371. ------------------------------------- | Setup | # of null checks | ------------------------------------- | unpatched, -O0 | 45439 | | patched, -O0 | 25251 | (-44.4%) ------------------------------------- llvm-svn: 300508
* CodeGen: Let byval parameter use alloca address spaceYaxun Liu2017-04-171-2/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D32133 llvm-svn: 300487
* CodeGen: Let lifetime intrinsic use alloca address spaceYaxun Liu2017-04-173-4/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D31717 llvm-svn: 300485
* [ObjC] Mark loads from __NSArray0 and __NSDictionary0 as invariant.load.Akira Hatanaka2017-04-171-4/+6
| | | | | | | | Also, simplify code by calling MakeNaturalAlignAddrLValue. This is a follow-up to r300396. llvm-svn: 300454
* [ObjC] Use empty Objective-C collection literal constants whenAkira Hatanaka2017-04-151-2/+14
| | | | | | | | | | | | | available. Original patch by Douglas Gregor with minor modifications. This recommits r300389, which broke bots because there have been API changes since the original patch was written. rdar://problem/20689633 llvm-svn: 300396
* Revert "[ObjC] Use empty Objective-C collection literal constants when"Akira Hatanaka2017-04-151-14/+2
| | | | | | | This reverts commit r300389. There were mistakes in the changes I made to CodeGen. llvm-svn: 300391
* [ObjC] Use empty Objective-C collection literal constants whenAkira Hatanaka2017-04-151-2/+14
| | | | | | | | | | available. Original patch by Douglas Gregor with minor modifications. rdar://problem/20689633 llvm-svn: 300389
* [Coverage] Use the new getInstrProfSectionName API (NFC)Vedant Kumar2017-04-151-1/+3
| | | | llvm-svn: 300382
* [ubsan] Don't check alignment if the alignment is 1Vedant Kumar2017-04-141-1/+1
| | | | | | | | | | | | | | If a pointer is 1-byte aligned, there's no use in checking its alignment. Somewhat surprisingly, ubsan can spend a significant amount of time doing just that! This loosely depends on D30283. Testing: check-clang, check-ubsan, and a stage2 ubsan build. Differential Revision: https://reviews.llvm.org/D30285 llvm-svn: 300371
OpenPOWER on IntegriCloud