summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* PR22877: When constructing an array via a constructor with a default argumentRichard Smith2017-05-111-6/+14
| | | | | | | | | | in list-initialization, run cleanups for the default argument after each iteration of the initialization loop. We previously only ran the destructor for any temporary once, at the end of the complete loop, rather than once per iteration! llvm-svn: 302750
* Reland: [mips] Impose a threshold for coercion of aggregatesPetar Jovanovic2017-05-101-0/+8
| | | | | | | | | | | | | | Modified MipsABIInfo::classifyArgumentType so that it now coerces aggregate structures only if the size of said aggregate is less than 16/64 bytes, depending on the ABI. Patch by Stefan Maksimovic. Differential Revision: https://reviews.llvm.org/D32900 with minor changes (use regexp instead of the hardcoded values) to the test. llvm-svn: 302670
* [ubsan] Mark overflow checks with !nosanitizeVedant Kumar2017-05-091-1/+1
| | | | | | | | | Sanitizer instrumentation generally needs to be marked with !nosanitize, but we're not doing this properly for ubsan's overflow checks. r213291 has more information about why this is needed. llvm-svn: 302598
* [asan] A clang flag to enable ELF globals-gc.Evgeniy Stepanov2017-05-091-0/+2
| | | | | | | | | | | | This feature is subtly broken when the linker is gold 2.26 or earlier. See the following bug for details: https://sourceware.org/bugzilla/show_bug.cgi?id=19002 Since the decision needs to be made at compilation time, we can not test the linker version. The flag is off by default on ELF targets, and on otherwise. llvm-svn: 302591
* Fix CGObjCGNU::init bug introduced by r302572Serge Guelton2017-05-091-2/+7
| | | | llvm-svn: 302588
* Suppress all uses of LLVM_END_WITH_NULL. NFC.Serge Guelton2017-05-0914-213/+152
| | | | | | | | | | Use variadic templates instead of relying on <cstdarg> + sentinel. This enforces better type checking and makes code more readable. Differential revision: https://reviews.llvm.org/D32550 llvm-svn: 302572
* Revert r302547 ([mips] Impose a threshold for coercion of aggregates)Petar Jovanovic2017-05-091-8/+0
| | | | | | | | | | Reverting Modified MipsABIInfo::classifyArgumentType so that it now coerces aggregate structures only if the size of said aggregate is less than 16/64 bytes, depending on the ABI. as it broke clang-with-lto-ubuntu builder. llvm-svn: 302555
* [mips] Impose a threshold for coercion of aggregatesPetar Jovanovic2017-05-091-0/+8
| | | | | | | | | | | | Modified MipsABIInfo::classifyArgumentType so that it now coerces aggregate structures only if the size of said aggregate is less than 16/64 bytes, depending on the ABI. Patch by Stefan Maksimovic. Differential Revision: https://reviews.llvm.org/D32900 llvm-svn: 302547
* [CodeGen][ObjC] Emit @objc_retain at -O0 for variables captured byAkira Hatanaka2017-05-091-1/+2
| | | | | | | | | | | blocks. r302270 made changes to avoid emitting clang.arc.use at -O0 and instead emit @objc_release. We also have to emit @objc_retain for the captured variable at -O0 to match the @objc_release instead of just storing the pointer to the capture field. llvm-svn: 302495
* [XRay] Add __xray_customeevent(...) as a clang-supported builtinDean Michael Berris2017-05-091-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We define the `__xray_customeevent` builtin that gets translated to IR calls to the correct intrinsic. The default implementation of this is a no-op function. The codegen side of this follows the following logic: - When `-fxray-instrument` is not provided in the driver, we elide all calls to `__xray_customevent`. - When `-fxray-instrument` is enabled and a function is marked as "never instrumented", we elide all calls to `__xray_customevent` in that function; if either marked as "always instrumented" or subject to threshold-based instrumentation, we emit a call to the `llvm.xray.customevent` intrinsic from LLVM for each `__xray_customevent` occurrence in the function. This change depends on D27503 (to land in LLVM first). Reviewers: echristo, rsmith Subscribers: mehdi_amini, pelikan, lrl, cfe-commits Differential Revision: https://reviews.llvm.org/D30018 llvm-svn: 302492
* Rename a method. NFC.Vedant Kumar2017-05-091-3/+3
| | | | llvm-svn: 302490
* [sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a ↵Kostya Serebryany2017-05-051-0/+1
| | | | | | hidden -mllvm flag. clang part. llvm-svn: 302320
* AArch64: fix weird edge case in ABI.Tim Northover2017-05-051-4/+9
| | | | | | | | | | | | | | | | | It turns out there are some sort-of-but-not-quite empty structs that break all the rules. For example: struct SuperEmpty { int arr[0]; }; struct SortOfEmpty { struct SuperEmpty e; }; Both of these have sizeof == 0, even in C++ mode, for GCC compatibility. The first one also doesn't occupy a register when passed by value in GNU C++ mode, unlike everything else. On Darwin, we want to ignore the lot (and especially don't want to try to use an i0 as we were). llvm-svn: 302313
* CodeGen: avoid use of @clang.arc.use intrinsic at O0Saleem Abdulrasool2017-05-051-2/+6
| | | | | | | | | The clang.arc.use intrinsic is removed via the ARC Contract Pass. This pass is only executed in optimized builds (>= opt level 1). Prevent the optimization implemented in SVN r301667 from triggering at optimization level 0 like every other ARC use intrinsic usage. llvm-svn: 302270
* ANSIfy more. Still no behavior change.Nico Weber2017-05-051-1/+1
| | | | llvm-svn: 302259
* 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
OpenPOWER on IntegriCloud