summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* CodeGen: Define Swift's legal vector types for AArch64, ARMArnold Schwaighofer2017-05-261-0/+30
| | | | | | rdar://32401301 llvm-svn: 304017
* [X86] Adding avx512_vpopcntdq feature set and its intrinsicsOren Ben Simhon2017-05-251-31/+39
| | | | | | | | | | AVX512_VPOPCNTDQ is a new feature set that was published by Intel. The patch represents the Clang side of the addition of six intrinsics for two new machine instructions (vpopcntd and vpopcntq). It also includes the addition of the new feature set. Differential Revision: https://reviews.llvm.org/D33170 llvm-svn: 303857
* [CodeGen] Pessimize aliasing for member unions (and may-alias) objectsKrzysztof Parzyszek2017-05-251-14/+17
| | | | | | | | Use the TBAA info of the omnipotent char for these objects. Differential Revision: https://reviews.llvm.org/D33328 llvm-svn: 303851
* [coroutines] Add support for coroutines with non-scalar parametersGor Nishanov2017-05-241-6/+85
| | | | | | | | | | | | | | Summary: Simple types like int are handled by LLVM Coroutines just fine. But for non-scalar parameters we need to create copies of those parameters in the coroutine frame and make all uses of those parameters to refer to parameter copies. Reviewers: rsmith, EricWF, GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33507 llvm-svn: 303803
* [PowerPC] Implement vec_xxsldwi builtin.Tony Jiang2017-05-241-0/+41
| | | | | | | | | | The vec_xxsldwi builtin is missing from altivec.h. This has been requested by developers working on libvpx for VP9 support for Google. The patch fixes PR: https://bugs.llvm.org/show_bug.cgi?id=32653 Differential Revision: https://reviews.llvm.org/D33236 llvm-svn: 303766
* [PowerPC] Implement vec_xxpermdi builtin.Tony Jiang2017-05-241-0/+33
| | | | | | | | | | The vec_xxpermdi builtin is missing from altivec.h. This has been requested by developers working on libvpx for VP9 support for Google. The patch fixes PR: https://bugs.llvm.org/show_bug.cgi?id=32653 Differential Revision: https://reviews.llvm.org/D33053 llvm-svn: 303760
* [XRay][clang] Allow imbuing arg1 logging attribute via -fxray-always-instrument=Dean Michael Berris2017-05-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: This change allows us to add arg1 logging support to functions through the special case list provided through -fxray-always-instrument=. This is useful for adding arg1 logging to functions that are either in headers that users don't have control over (i.e. cannot change the source) or would rather not do. It only takes effect when the pattern is matched through the "fun:" special case, as a category. As in: fun:*pattern=arg1 Reviewers: pelikan, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33392 llvm-svn: 303719
* [coroutines] Implement correct GRO lifetimeGor Nishanov2017-05-241-1/+72
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Sema creates a declaration for gro variable as: auto $gro = $promise.get_return_object(); However, gro variable has to outlive coroutine frame and coroutine promise, but, it can only be initialized after the coroutine promise was created, thus, we split its emission in two parts: EmitGroAlloca emits an alloca and sets up the cleanups. Later when the coroutine promise is available we initialize the gro and set the flag that the cleanup is now active. Duplicate of: https://reviews.llvm.org/D31670 (which arc patch refuses to apply for some reason) Reviewers: GorNishanov, rsmith Reviewed By: GorNishanov Subscribers: EricWF, cfe-commits Differential Revision: https://reviews.llvm.org/D33477 llvm-svn: 303716
* [coroutines] Fix leak in CGCoroutine.cppGor Nishanov2017-05-241-0/+4
| | | | | | FinalBB need to be emitted even when unused to make sure it is deleted llvm-svn: 303714
* [coroutines] Skip over passthrough operator co_awaitGor Nishanov2017-05-231-0/+14
| | | | | | https://reviews.llvm.org/D31627 llvm-svn: 303605
* [coroutines] Add emission of initial and final suspendsGor Nishanov2017-05-231-2/+6
| | | | | | https://reviews.llvm.org/D31608 llvm-svn: 303603
* [coroutines] Add support for deallocation elisionGor Nishanov2017-05-231-8/+50
| | | | | | | | | | Wrap deallocation code with: if (auto *mem = coro.free()) Deallocate When backend decides to elide allocations it will replace coro.free with nullptr to suppress deallocation code. llvm-svn: 303599
* [coroutines] Replace all coro.frame builtins with an SSA value of coro.beginGor Nishanov2017-05-231-1/+24
| | | | | | | | SemaCoroutine forms expressions referring to the coroutine frame of the enclosing coroutine using coro.frame builtin. During codegen, we emit llvm.coro.begin intrinsic that returns the address of the coroutine frame. When coro.frame is emitted, we replace it with SSA value of coro.begin. llvm-svn: 303598
* [coroutines] Add support for allocation elisionGor Nishanov2017-05-231-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We wrap allocation code so that backend can elide it if necessary. llvm.coro.alloc intrinsic returns true, when allocation is needed and false otherwise. ``` %NeedAlloc = call i1 @llvm.coro.alloc(token %2) br i1 %NeedAlloc, label %AllocBB, label %InitBB AllocBB: %5 = call i64 @llvm.coro.size.i64() %call = call i8* @_Znwm(i64 %5) ; operator new br label %InitBB InitBB: %Phi = phi i8* [ null, %0 ], [ %call, %4 ] call i8* @llvm.coro.begin(token %2, i8* %Phi) ``` Reviewers: majnemer, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31584 llvm-svn: 303596
* [coroutines] Wrap the body of the coroutine in try-catchGor Nishanov2017-05-221-1/+22
| | | | | | | | | | | | | | | | | | | | | | Summary: If unhandled_exception member function is present in the coroutine promise, wrap the body of the coroutine in: ``` try { body } catch(...) { promise.unhandled_exception(); } ``` Reviewers: EricWF, rnk, rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31692 llvm-svn: 303583
* [coroutines] Build GRO declaration and return GRO statementGor Nishanov2017-05-221-1/+5
| | | | | | | | | | | | | | | | | | Summary: 1. build declaration of the gro local variable that keeps the result of get_return_object. 2. build return statement returning the gro variable 3. emit them during CodeGen 4. sema and CodeGen tests updated Reviewers: EricWF, rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31646 llvm-svn: 303573
* [mips] Support `micromips` attributeSimon Atanasyan2017-05-221-0/+5
| | | | | | | | | This patch adds support for the `micromips` and `nomicromips` attributes for MIPS targets. Differential revision: https://reviews.llvm.org/D33363 llvm-svn: 303546
* [Devirtualization] insert placement new barrier with -O0Piotr Padlewski2017-05-201-1/+2
| | | | | | | | | | | | | | | | Summary: To not break LTO with different optimizations levels, we should insert the barrier regardles of optimization level. Reviewers: rjmccall, rsmith, mehdi_amini Reviewed By: mehdi_amini Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D32401 llvm-svn: 303488
* CodeGenModule: Always output wchar_size, check LLVM assumptions.Matthias Braun2017-05-201-6/+13
| | | | | | | | | | | | | | Re-commit r303463 now that LLVM is fixed and adjust some lit tests. llvm::TargetLibraryInfo needs to know the size of wchar_t to work on functions like `wcslen`. This patch changes clang to always emit the wchar_size module flag (it would only do so for ARM previously). This also adds an `assert()` to ensure the LLVM defaults based on the target triple are in sync with clang. Differential Revision: https://reviews.llvm.org/D32982 llvm-svn: 303478
* Revert "CodeGenModule: Always output wchar_size, check LLVM assumptions."Matthias Braun2017-05-201-13/+6
| | | | | | | | | Let's revert this for now (and with it the assert()) to get the bots back to green until I have LLVM synced up properly. This reverts commit r303463. llvm-svn: 303474
* CodeGenModule: Always output wchar_size, check LLVM assumptions.Matthias Braun2017-05-191-6/+13
| | | | | | | | | | | | llvm::TargetLibraryInfo needs to know the size of wchar_t to work on functions like `wcslen`. This patch changes clang to always emit the wchar_size module flag (it would only do so for ARM previously). This also adds an `assert()` to ensure the LLVM defaults based on the target triple are in sync with clang. Differential Revision: https://reviews.llvm.org/D32982 llvm-svn: 303463
* Restore and update documentation comment for EmitPointerWithAlignmentKrzysztof Parzyszek2017-05-191-5/+16
| | | | llvm-svn: 303419
* CodeGenFunction::EmitPointerWithAlignment(): Prune a \param in r303358, ↵NAKAMURA Takumi2017-05-191-15/+0
| | | | | | possibly obsolete. [-Wdocumentation] llvm-svn: 303414
* CodeGen: Cast alloca to expected address spaceYaxun Liu2017-05-186-13/+44
| | | | | | | | | | | Alloca always returns a pointer in alloca address space, which may be different from the type defined by the language. For example, in C++ the auto variables are in the default address space. Therefore cast alloca to the expected address space when necessary. Differential Revision: https://reviews.llvm.org/D32248 llvm-svn: 303370
* [CodeGen] Propagate LValueBaseInfo instead of AlignmentSourceKrzysztof Parzyszek2017-05-1813-183/+237
| | | | | | | | | | | | | The functions creating LValues propagated information about alignment source. Extend the propagated data to also include information about possible unrestricted aliasing. A new class LValueBaseInfo will contain both AlignmentSource and MayAlias info. This patch should not introduce any functional changes. Differential Revision: https://reviews.llvm.org/D33284 llvm-svn: 303358
* [modules] Switch from inferring owning modules based on source location toRichard Smith2017-05-181-1/+1
| | | | | | | | | | | | | | | inferring based on the current module at the point of creation. This should result in no functional change except when building a preprocessed module (or more generally when using #pragma clang module begin/end to switch module in the middle of a file), in which case it allows us to correctly track the owning module for declarations. We can't map from FileID to module in the preprocessed module case, since all modules would have the same FileID. There are still a couple of remaining places that try to infer a module from a source location; I'll clean those up in follow-up changes. llvm-svn: 303322
* Fix scope of namespaced DISubprograms when the function definition is ↵Adrian Prantl2017-05-161-1/+1
| | | | | | | | | | | | | | out-of-line. This fixes a regression introduced in r302915. Using the lexical decl context is not necessary here for what r302915 wast trying to achieve. Not canonicalizing the NamespaceDecl in getOrCreateNamespace is suficient. rdar://problem/29339538 llvm-svn: 303222
* [OpenCL] Emit function-scope variable in constant address space as static ↵Yaxun Liu2017-05-151-5/+8
| | | | | | | | variable Differential Revision: https://reviews.llvm.org/D32977 llvm-svn: 303072
* Remove ignore-empty-index-file optionTeresa Johnson2017-05-121-1/+2
| | | | | | | | | | | | | | | | Summary: Clang changes to remove this option and replace with a parameter always set in the context of a ThinLTO distributed backend. Depends on D33133. Reviewers: pcc Subscribers: mehdi_amini, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D33134 llvm-svn: 302940
* Simplify DINamespace caching in CGDebugInfoAdrian Prantl2017-05-122-31/+16
| | | | | | | | | | | | | | This addresses review feedback from r302840. By not canonicalizing namespace decls and using lexical decl context instead of lookuing up the semantic decl context we can take advantage of the fact that DINamespaces a reuniqued. This way non-module debug info is unchanged and module debug info still gets distinct namespace declarations when they ocur in different modules. Thanks to Richard Smith for pointing this out! llvm-svn: 302915
* [Hexagon] Make sure to pass empty struct arguments with nontrivial ctorsKrzysztof Parzyszek2017-05-121-3/+3
| | | | | | | | Thanks to Richard Smith for the suggested fix. This fixes llvm.org/PR33009 llvm-svn: 302895
* Fix uninitialized bool read causing x86_64-mno-sse.c test failureReid Kleckner2017-05-121-5/+5
| | | | llvm-svn: 302854
* Module Debug Info: Emit namespaced C++ forward decls in the correct module.Adrian Prantl2017-05-112-13/+32
| | | | | | | | | | | | The AST merges NamespaceDecls, but for module debug info it is important to put a namespace decl (or rather its children) into the correct (sub-)module, so we need to use the parent module of the decl that triggered this namespace to be serialized as a second key when looking up DINamespace nodes. rdar://problem/29339538 llvm-svn: 302840
* 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! Re-commit of r302750, reverted in r302776. llvm-svn: 302817
* Revert "PR22877: When constructing an array via a constructor with a default ↵Diana Picus2017-05-111-14/+6
| | | | | | | | | | | | | | | | | | | | | | | argument in list-initialization, run cleanups for the default argument after each iteration of the initialization loop." Revert "clang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thiscallcc." This reverts commit r302750 and its fixup r302757 because the test is still breaking on some of the ARM bots. array-default-argument.cpp:20:12: error: expected string not found in input // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void @_ZN1AC1Ev([[TEMPORARY:.*]]) ^ <stdin>:18:1: note: scanning from here arrayctor.loop: ; preds = %arrayctor.loop, %entry ^ <stdin>:28:2: note: possible intended match here call void @_Z1fv() ^ -- llvm-svn: 302776
* 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
OpenPOWER on IntegriCloud