summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Prevent the creation of empty (forwarding) blocks resulting from nested ifs.Wolfgang Pieb2016-07-111-1/+13
| | | | | | | | | | | | | | | | | Summary: Nested if statements can generate empty BBs whose terminator branches unconditionally to its successor. These branches are not eliminated to help generate better line number information in some cases, but there is no reason to keep the empty blocks that result from nested ifs. Reviewers: mehdi_amini, dblaikie, echristo Subscribers: mehdi_amini, cfe-commits Differential review: http://reviews.llvm.org/D11360 llvm-svn: 275115
* [CodeGen] Treat imported static local variables as declarationsDavid Majnemer2016-07-112-4/+4
| | | | | | | Imported variables cannot really be definitions for the purposes of IR generation. llvm-svn: 275040
* AMDGPU: Export workitem builtinsJan Vesely2016-07-101-0/+28
| | | | | | | | Reviewers: tstellardAMD Differential Revision: http://reviews.llvm.org/D20299 llvm-svn: 275030
* Delete dead code.Sean Silva2016-07-101-1/+0
| | | | | | We were just setting DisableUnitAtATime to its default value. llvm-svn: 275005
* [MS ABI] Some code cleanupsDavid Majnemer2016-07-091-9/+6
| | | | | | | | Don't create unnecessary truncations if the result will not be used. Also prefer preforming math before the truncation, it makes it a little easier to reason about. llvm-svn: 274984
* CodeGen: tweak CFString section for COFF, ELFSaleem Abdulrasool2016-07-091-3/+1
| | | | | | | | | Place the structure data into `cfstring`. This both isolates the structures to permit coalescing in the future (by the linker) as well as ensures that it doesnt get marked as read-only data. The structures themselves are not read-only, only the string contents. llvm-svn: 274956
* [OpenCL] Add missing -cl-no-signed-zeros option into driverYaxun Liu2016-07-081-0/+2
| | | | | | | | | | | | Add OCL option -cl-no-signed-zeros to driver options. Also added to opencl.cl testcases. Patch by Aaron En Ye Shi. Differential Revision: http://reviews.llvm.org/D22067 llvm-svn: 274923
* [CodeGen] Use llvm::Type::getVectorNumElements instead of casting to ↵Craig Topper2016-07-083-7/+5
| | | | | | llvm::VectorType and calling getNumElements. This is equivalent and shorter. llvm-svn: 274823
* [X86] Reuse existing lambda and remove unnecessary argument from vector cmp ↵Craig Topper2016-07-081-16/+11
| | | | | | builtin handling. NFC llvm-svn: 274821
* [X86] Remove a couple calls to create V2F64 and V4F32 types for builtin ↵Craig Topper2016-07-081-29/+17
| | | | | | handling. Just get the type from the operand of the builtin instead. NFC llvm-svn: 274820
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-071-4/+2
| | | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274732
* Revert "Retry "Include debug info for nested structs and classes""Adrian McCarthy2016-07-062-14/+2
| | | | | | | | | | Reverting because it causes a test failure on build bots (Modules/ModuleDebugInfo.cpp). Failure does not reproduce locally. svn revision: rL274698 This reverts commit 3c5ed6599b086720aab5b8bd6941149d066806a6. llvm-svn: 274706
* Retry "Include debug info for nested structs and classes"Adrian McCarthy2016-07-062-2/+14
| | | | | | | | | | This should work now that the LLVM-side of the change has landed successfully. Original Differential Revision: http://reviews.llvm.org/D21705 This reverts commit a30322e861c387e1088f47065d0438c6bb019879. llvm-svn: 274698
* [CodeGen, DebugInfo] Use hasLocalLinkage instead of hasInternalLinkageDavid Majnemer2016-07-061-3/+3
| | | | | | | | For the purpose of emitting debug info, entities with private linkage should be treated the same as internal linkage. While this doesn't change anything in practice, it makes the code a little less confusing. llvm-svn: 274677
* Revert "Include debug info for nested structs and classes"Adrian McCarthy2016-07-062-14/+2
| | | | | | This reverts commit 0af5ee9631c7c167dc40498b415876553e314c95. llvm-svn: 274633
* Include debug info for nested structs and classesAdrian McCarthy2016-07-062-2/+14
| | | | | | | | This includes nested types in the member list, even if there are no members of that type. Note that structs and classes have themselves as an "implicit struct" as the first member, so we skip implicit ones. Differential Revision: http://reviews.llvm.org/D21705 llvm-svn: 274628
* [X86] Use native IR for immediate values 0-7 of packed fp cmp builtins. This ↵Craig Topper2016-07-061-0/+45
| | | | | | makes them the same as what is done when using the SSE builtins for these same encodings. llvm-svn: 274608
* [OpenMP] Sema and parsing for 'distribute simd' pragmaKelvin Li2016-07-063-0/+17
| | | | | | | | Summary: This patch is an implementation of sema and parsing for the OpenMP composite pragma 'distribute simd'. Differential Revision: http://reviews.llvm.org/D22007 llvm-svn: 274604
* [AVX512] Use the generic ctlz intrinsic to implement the vplzcntd/q builtins.Craig Topper2016-07-061-0/+12
| | | | llvm-svn: 274603
* Delete some dead code, NFCVedant Kumar2016-07-061-10/+0
| | | | | | Found using clang's code coverage tool. llvm-svn: 274599
* [OpenCL] An implementation of device side enqueue (DSE) from OpenCL v2.0 ↵Anastasia Stulova2016-07-051-0/+142
| | | | | | | | | | | | | | | | | s6.13.17. - Added new Builtins: enqueue_kernel, get_kernel_work_group_size and get_kernel_preferred_work_group_size_multiple. These Builtins use custom check to diagnose parameters of the passed Blocks i. e. variable number of 'local void*' type params, and check different overloads specified in Table 6.31 of OpenCL v2.0. - IR is generated as an internal library call for each OpenCL Builtin, reusing ObjC Block implementation. Review: http://reviews.llvm.org/D20249 llvm-svn: 274540
* [OpenMP] Sema and parse for 'distribute parallel for simd'Kelvin Li2016-07-053-0/+17
| | | | | | | | Summary: This patch is an implementation of sema and parsing for the OpenMP composite pragma 'distribute parallel for simd'. Differential Revision: http://reviews.llvm.org/D21977 llvm-svn: 274530
* [OpenCL] Make OpenCL Builtins added according to the right version.Anastasia Stulova2016-07-041-1/+1
| | | | | | | | | | Currently we only have OpenCL 2.0 Builtins i.e. pipes or address space conversions. They have to be added only in the version 2.0 compilation mode to make the identifiers available for use in the other versions. Review: http://reviews.llvm.org/D20249 llvm-svn: 274509
* [AVX512] Modify what indices we emit for the zero vector we use for zero ↵Craig Topper2016-07-041-1/+1
| | | | | | extension of the result of a v2i1 or v4i1 masked compare. This way we emit something that the backend easily interprets as a concatenation rather than a true shuffle. This delivers slightly better codegen with the current backend capabilities. llvm-svn: 274484
* [CUDA] Move argument type lists to the stack. NFC.Benjamin Kramer2016-07-021-4/+4
| | | | llvm-svn: 274433
* Use arrays or initializer lists to feed ArrayRefs instead of SmallVector ↵Benjamin Kramer2016-07-024-74/+47
| | | | | | | | where possible. No functionality change intended llvm-svn: 274432
* PR28394: For compatibility with c++11 and c++14, if a static constexpr dataRichard Smith2016-07-021-1/+13
| | | | | | | | member is redundantly redeclared outside the class definition in code built in c++17 mode, ensure we emit a non-discardable definition of the data member for c++11 and c++14 compilations to use. llvm-svn: 274416
* [CodeView] Include MSVC style names for unnamed typesDavid Majnemer2016-07-011-9/+45
| | | | | | | | The CodeView printer expects to be able to generate fully qualified names from the debug info graph. This means that we need to include the MSVC-style name in the debug info for anonymous types. llvm-svn: 274401
* [Temporary, Lifetime] Add lifetime marks for temporariesTim Shen2016-07-015-20/+41
| | | | | | | | | With all MaterializeTemporaryExprs coming with a ExprWithCleanups, it's easy to add correct lifetime.end marks into the right RunCleanupsScope. Differential Revision: http://reviews.llvm.org/D20499 llvm-svn: 274385
* Emit more intrinsics for builtin functionsMatt Arsenault2016-07-011-39/+92
| | | | | | | | | | | | This is important for building libclc. Since r273039 tests are failing due to now emitting calls to these functions instead of emitting the DAG node. The libm function names are implemented for OpenCL, and should call the locally defined versions, so -fno-builtin is used. The IR Some functions use the __builtins and expect the intrinsics to be emitted. Without this we end up with nobuiltin calls to intrinsics or to unsupported library calls. llvm-svn: 274370
* [DebugInfo] Set DISubprogram ThisAdjustment in the MS ABIReid Kleckner2016-07-013-7/+17
| | | | llvm-svn: 274326
* fix typo; NFCSanjay Patel2016-06-301-1/+1
| | | | llvm-svn: 274278
* [CUDA] Give templated device functions internal linkage, templated kernels ↵Justin Lebar2016-06-301-3/+12
| | | | | | | | | | | | | | | | | external linkage. Summary: This lets LLVM perform IPO over these functions. In particular, it allows LLVM to emit ld.global.nc for loads to __restrict pointers in kernels that are never written to. Reviewers: rsmith Subscribers: cfe-commits, tra Differential Revision: http://reviews.llvm.org/D21337 llvm-svn: 274261
* [codeview] Emit qualified display names if -gline-tables-only is onReid Kleckner2016-06-301-4/+14
| | | | | | | | | | | | | | | | | | When -gmlt is on, we don't emit namespace or class scope information, and the CodeView emission code in LLVM can't compute the fully qualified name. If we know LLVM won't be able to get the name right, go ahead and emit the qualified name in the frontend. We could change our -gmlt emission strategy to include those scopes when emitting codeview, but that would increase memory usage and slow down LTO and add more complexity to debug info emission. The same problem exists when you debug a -gmlt binary with GDB, so we should consider removing '&& EmitCodeView' from the condition here at some point in the future after evaluating the impact on object file size. llvm-svn: 274246
* AMDGPU: Set amdgpu_kernel calling convention for OpenCL kernels.Nikolay Haustov2016-06-305-3/+22
| | | | | | | | | | | | | | | | | | Summary: Summary: Change Clang calling convention SpirKernel to OpenCLKernel. Set calling convention OpenCLKernel for amdgcn as well. Add virtual method .getOpenCLKernelCallingConv() to TargetCodeGenInfo and use it to set target calling convention for AMDGPU and SPIR. Update tests. Reviewers: rsmith, tstellarAMD, Anastasia, yaxunl Subscribers: kzhuravl, cfe-commits Differential Revision: http://reviews.llvm.org/D21367 llvm-svn: 274220
* [CodeView] Implement support for bitfields in ClangDavid Majnemer2016-06-302-37/+63
| | | | | | | | | | | Emit the underlying storage offset in addition to the starting bit position of the field. This fixes PR28162. Differential Revision: http://reviews.llvm.org/D21783 llvm-svn: 274201
* Re-land "[MS] Don't expect vftables to be provided for extern template ↵Reid Kleckner2016-06-291-3/+7
| | | | | | | | | | | | | | instantiations" Reverts r273305 and re-instates r273296. We needed to fix a bug in Sema::MarkVTableUsed to ensure that operator delete lookup occurs when the vtable is referenced. We already had a special case to look up operator delete when dllimport was used, but I think should really mark virtual destructors referenced any time the vtable is used. llvm-svn: 274147
* [AVX512] Zero extend cmp intrinsic return value.Igor Breger2016-06-291-2/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D21746 llvm-svn: 274110
* Revert "[Coverage] Adopt llvm::coverage::encodeFilenamesAndRawMappings (NFC)"Vedant Kumar2016-06-291-10/+18
| | | | | | | | | This reverts commit 161ff9db3a3d0d62880d1cb18d58182cd3034912 (r273056). This is breaking stage2 instrumented builds with "malformed coverage data" errors. llvm-svn: 274104
* [Diag] Add getter shouldAlwaysPrint. NFCAdam Nemet2016-06-291-3/+3
| | | | | | | | | | For the new hotness attribute, the API will take the pass rather than the pass name so we can no longer play the trick of AlwaysPrint being a special pass name. This adds a getter to help the transition. There is also a corresponding llvm patch. llvm-svn: 274101
* P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:Richard Smith2016-06-288-69/+337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace inheriting constructors implementation with new approach, voted into C++ last year as a DR against C++11. Instead of synthesizing a set of derived class constructors for each inherited base class constructor, we make the constructors of the base class visible to constructor lookup in the derived class, using the normal rules for using-declarations. For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived class that tracks the requisite additional information. We create shadow constructors (not found by name lookup) in the derived class to model the actual initialization, and have a new expression node, CXXInheritedCtorInitExpr, to model the initialization of a base class from such a constructor. (This initialization is special because it performs real perfect forwarding of arguments.) In cases where argument forwarding is not possible (for inalloca calls, variadic calls, and calls with callee parameter cleanup), the shadow inheriting constructor is not emitted and instead we directly emit the initialization code into the caller of the inherited constructor. Note that this new model is not perfectly compatible with the old model in some corner cases. In particular: * if B inherits a private constructor from A, and C uses that constructor to construct a B, then we previously required that A befriends B and B befriends C, but the new rules require A to befriend C directly, and * if a derived class has its own constructors (and so its implicit default constructor is suppressed), it may still inherit a default constructor from a base class llvm-svn: 274049
* AMDGPU: Add builtin to read exec maskMatt Arsenault2016-06-281-4/+14
| | | | llvm-svn: 273965
* Resubmission of http://reviews.llvm.org/D21564 after fixes.Carlo Bertolli2016-06-273-0/+18
| | | | | | | | | | | | | [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for' This patch is an initial implementation for #distribute parallel for. The main differences that affect other pragmas are: The implementation of 'distribute parallel for' requires blocking of the associated loop, where blocks are "distributed" to different teams and iterations within each block are scheduled to parallel threads within each team. To implement blocking, sema creates two additional worksharing directive fields that are used to pass the team assigned block lower and upper bounds through the outlined function resulting from 'parallel'. In this way, scheduling for 'for' to threads can use those bounds. As a consequence of blocking, the stride of 'distribute' is not 1 but it is equal to the blocking size. This is returned by the runtime and sema prepares a DistIncrExpr variable to hold that value. As a consequence of blocking, the global upper bound (EnsureUpperBound) expression of the 'for' is not the original loop upper bound (e.g. in for(i = 0 ; i < N; i++) this is 'N') but it is the team-assigned block upper bound. Sema creates a new expression holding the calculation of the actual upper bound for 'for' as UB = min(UB, PrevUB), where UB is the loop upper bound, and PrevUB is the team-assigned block upper bound. llvm-svn: 273884
* CodeGen: Start emitting checked loads when both trapping CFI and ↵Peter Collingbourne2016-06-254-11/+69
| | | | | | | | -fwhole-program-vtables are enabled. Differential Revision: http://reviews.llvm.org/D21122 llvm-svn: 273757
* Implement C++17 P0386R2, inline variables. (The 'inline' specifier gives aRichard Smith2016-06-252-4/+22
| | | | | | | variable weak discardable linkage and partially-ordered initialization, and is implied for constexpr static data members.) llvm-svn: 273754
* Add support for musl-libc on ARM Linux.Rafael Espindola2016-06-241-0/+4
| | | | | | Patch by Lei Zhang! llvm-svn: 273735
* CodeGen: Update Clang to use the new type metadata.Peter Collingbourne2016-06-248-124/+83
| | | | | | Differential Revision: http://reviews.llvm.org/D21054 llvm-svn: 273730
* Revert r273705Carlo Bertolli2016-06-243-18/+0
| | | | | | [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for' llvm-svn: 273709
* [OpenMP] Initial implementation of parse and sema for composite pragma ↵Carlo Bertolli2016-06-243-0/+18
| | | | | | | | | | | | | | | 'distribute parallel for' http://reviews.llvm.org/D21564 This patch is an initial implementation for #distribute parallel for. The main differences that affect other pragmas are: The implementation of 'distribute parallel for' requires blocking of the associated loop, where blocks are "distributed" to different teams and iterations within each block are scheduled to parallel threads within each team. To implement blocking, sema creates two additional worksharing directive fields that are used to pass the team assigned block lower and upper bounds through the outlined function resulting from 'parallel'. In this way, scheduling for 'for' to threads can use those bounds. As a consequence of blocking, the stride of 'distribute' is not 1 but it is equal to the blocking size. This is returned by the runtime and sema prepares a DistIncrExpr variable to hold that value. As a consequence of blocking, the global upper bound (EnsureUpperBound) expression of the 'for' is not the original loop upper bound (e.g. in for(i = 0 ; i < N; i++) this is 'N') but it is the team-assigned block upper bound. Sema creates a new expression holding the calculation of the actual upper bound for 'for' as UB = min(UB, PrevUB), where UB is the loop upper bound, and PrevUB is the team-assigned block upper bound. llvm-svn: 273705
* This patch fixes problem with passing structures and unionsStrahinja Petrovic2016-06-241-1/+2
| | | | | | | | smaller than register as argument in variadic functions on big endian architectures. Differential Revision: http://reviews.llvm.org/D21611 llvm-svn: 273665
OpenPOWER on IntegriCloud