summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [AArch64] Add ARMv8.2-A FP16 vefctor intrinsicsAbderrazek Zaafrani2017-06-013-7/+179
| | | | llvm-svn: 304493
* [CGDebugInfo] Finalize SubPrograms when we're done with themKeno Fischer2017-06-013-4/+7
| | | | | | | | | | | | | | | | | | `GenerateVarArgsThunk` in `CGVTables` clones a function before the frontend is done emitting the compilation unit. Because of the way that DIBuilder works, this means that the attached subprogram had incomplete (temporary) metadata. Cloning such metadata is semantically disallowed, but happened to work anyway due to bugs in the cloning logic. rL304226 attempted to fix up that logic, but in the process exposed the incorrect API use here and had to be reverted. To be able to fix this, I added a new method to DIBuilder in rL304467, to allow finalizing a subprogram independently of the entire compilation unit. Use that here, in preparation of re-applying rL304226. Reviewers: aprantl, dblaikie Differential Revision: https://reviews.llvm.org/D33705 llvm-svn: 304470
* Don't assume that a store source is a vector type just because the ↵Simon Pilgrim2017-06-011-2/+2
| | | | | | destination is (PR26099) llvm-svn: 304465
* [ubsan] Add a check for pointer overflow UBVedant Kumar2017-06-013-46/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check pointer arithmetic for overflow. For some more background on this check, see: https://wdtz.org/catching-pointer-overflow-bugs.html https://reviews.llvm.org/D20322 Patch by Will Dietz and John Regehr! This version of the patch is different from the original in a few ways: - It introduces the EmitCheckedInBoundsGEP utility which inserts checks when the pointer overflow check is enabled. - It does some constant-folding to reduce instrumentation overhead. - It does not check some GEPs in CGExprCXX. I'm not sure that inserting checks here, or in CGClass, would catch many bugs. Possible future directions for this check: - Introduce CGF.EmitCheckedStructGEP, to detect overflows when accessing structures. Testing: Apart from the added lit test, I ran check-llvm and check-clang with a stage2, ubsan-instrumented clang. Will and John have also done extensive testing on numerous open source projects. Differential Revision: https://reviews.llvm.org/D33305 llvm-svn: 304459
* [CodeGen][ObjC] Fix assertion failure in EmitARCStoreStrongCall.Akira Hatanaka2017-06-011-1/+5
| | | | | | | | | | | | | The assertion fails because EmitValueForIvarAtOffset doesn't get the correct type of the ivar when the class the ivar belongs to is parameterized. This commit fixes the function to compute the ivar's type based on the type argument provided to the parameterized class. rdar://problem/32461723 Differential Revision: https://reviews.llvm.org/D33698 llvm-svn: 304449
* Emit invariant.group.barrier when using union fieldPiotr Padlewski2017-06-011-0/+27
| | | | | | | | | | | | | | | | Summary: We need to emit barrier if the union field is CXXRecordDecl because it might have vptrs. The testcode was wrongly devirtualized. It also proves that having different groups for different dynamic types is not sufficient. Reviewers: rjmccall, rsmith, mehdi_amini Subscribers: amharc, cfe-commits Differential Revision: https://reviews.llvm.org/D31830 llvm-svn: 304448
* Fixed warningsPiotr Padlewski2017-06-011-2/+2
| | | | llvm-svn: 304397
* Emit available_externally vtables opportunisticallyPiotr Padlewski2017-06-015-18/+68
| | | | | | | | | | | | | | Summary: We can emit vtable definition having inline function if they are all emitted. Reviewers: rjmccall, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33437 llvm-svn: 304394
* [OpenCL] Makes kernels use the SPIR_KERNEL CC by default.Pekka Jaaskelainen2017-06-013-6/+35
| | | | | | | | | | | | | | | | Rationale: OpenCL kernels are called via an explicit runtime API with arguments set with clSetKernelArg(), not as normal sub-functions. Return SPIR_KERNEL by default as the kernel calling convention to ensure the fingerprint is fixed such way that each OpenCL argument gets one matching argument in the produced kernel function argument list to enable feasible implementation of clSetKernelArg() with aggregates etc. In case we would use the default C calling conv here, clSetKernelArg() might break depending on the target-specific conventions; different targets might split structs passed as values to multiple function arguments etc. https://reviews.llvm.org/D33639 llvm-svn: 304389
* Don't try to spill static allocas when emitting expr cleanups with branchesReid Kleckner2017-05-311-0/+7
| | | | | | | | | | | | | | | | | | Credit goes to Gor Nishanov for putting together the fix in https://reviews.llvm.org/D33733! This patch is essentially me patching it locally and writing some test cases to convince myself that it was necessary for GNU statement expressions with branches as well as coroutines. I'll ask Gor to land his patch with just the coroutines test. During LValue expression evaluation, references can be bound to anything, really: call results, aggregate temporaries, local variables, global variables, or indirect arguments. We really only want to spill instructions that were emitted as part of expression evaluation, and static allocas are not that. llvm-svn: 304335
* [CodeGen] Surround assertion with parens and format.Davide Italiano2017-05-311-4/+4
| | | | | | This should placate GCC7 with -Werror. llvm-svn: 304322
* CGCoroutine.cpp: (NFC) clang-format misplaced braceGor Nishanov2017-05-291-2/+1
| | | | llvm-svn: 304176
* IRGen: Add optnone attribute on function during O0Mehdi Amini2017-05-293-2/+15
| | | | | | | | | | | Amongst other, this will help LTO to correctly handle/honor files compiled with O0, helping debugging failures. It also seems in line with how we handle other options, like how -fnoinline adds the appropriate attribute as well. Differential Revision: https://reviews.llvm.org/D28404 llvm-svn: 304127
* [OpenMP] Create COMDAT group for OpenMP offload registration code to avoid ↵George Rokos2017-05-272-2/+18
| | | | | | | | | | multiple copies Thanks to Sergey Dmitriev for submitting the patch. Differential Revision: https://reviews.llvm.org/D33509 llvm-svn: 304056
* Make helper functions static. NFC.Benjamin Kramer2017-05-261-7/+7
| | | | llvm-svn: 304028
* 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
OpenPOWER on IntegriCloud