summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Add comments. NFCAdrian Prantl2016-08-221-0/+2
| | | | llvm-svn: 279490
* Module debug info: Don't assert when encountering an incomplete definitionAdrian Prantl2016-08-221-1/+2
| | | | | | | | | | in isDefinedInClangModule() and assume that the incomplete definition is not defined in the module. This broke the -gmodules self host recently. rdar://problem/27894367 llvm-svn: 279485
* AMDGPU: Handle structs directly in AMDGPUABIInfoMatt Arsenault2016-08-221-1/+41
| | | | | | | | | | | | | | | | Structs are currently handled as pointer + byval, which makes AMDGPU LLVM backend generate incorrect code when structs are used. This patch changes struct argument to be handled directly and without flattening, which Clover (Mesa 3D Gallium OpenCL state tracker) will be able to handle. Flattening would expand the struct to individual elements and pass each as a separate argument, which Clover can not handle. Furthermore, such expansion does not fit the OpenCL programming model which requires to explicitely specify each argument index, size and memory location. Patch by Vedran Miletić llvm-svn: 279463
* PR29086: DebugInfo: Improve support for fixed array dimensions in variable ↵David Blaikie2016-08-221-0/+5
| | | | | | length arrays llvm-svn: 279445
* Re-commit [OpenCL] AMDGCN: Fix size_t typeYaxun Liu2016-08-193-7/+18
| | | | | | There was a premature cast to pointer type in emitPointerArithmetic which caused assertion in tests with assertion enabled. llvm-svn: 279206
* AMDGPU: Add clang builtin for ds_swizzle.Changpeng Fang2016-08-181-0/+3
| | | | | | | | | | | Summary: int __builtin_amdgcn_ds_swizzle (int a, int imm); while imm is a constant. Differential Revision: http://reviews.llvm.org/D23682 llvm-svn: 279165
* CodeGen: Rename a variable to better fit LLVM style. NFCJustin Bogner2016-08-181-6/+6
| | | | llvm-svn: 279159
* CodeGen: use range based for loop, NFCSaleem Abdulrasool2016-08-181-3/+2
| | | | llvm-svn: 279154
* Revert [OpenCL] AMDGCN: Fix size_t typeYaxun Liu2016-08-183-18/+7
| | | | | | due to regressions in test/CodeGen/exprs.c on certain platforms. llvm-svn: 279127
* [OpenCL] AMDGCN: Fix size_t typeYaxun Liu2016-08-183-7/+18
| | | | | | | | Pointers of certain GPUs in AMDGCN target in private address space is 32 bit but pointers in other address spaces are 64 bit. size_t type should be defined as 64 bit for these GPUs so that it could hold pointers in all address spaces. Also fixed issues in pointer arithmetic codegen by using pointer specific intptr type. Differential Revision: https://reviews.llvm.org/D23361 llvm-svn: 279121
* Revert "[OpenMP] Sema and parsing for 'teams distribute simd’ pragma"Diana Picus2016-08-183-19/+0
| | | | | | | | | | | | | | | | | This reverts commit r279003 as it breaks some of our buildbots (e.g. clang-cmake-aarch64-quick, clang-x86_64-linux-selfhost-modules). The error is in OpenMP/teams_distribute_simd_ast_print.cpp: clang: /home/buildslave/buildslave/clang-cmake-aarch64-quick/llvm/include/llvm/ADT/DenseMap.h:527: bool llvm::DenseMapBase<DerivedT, KeyT, ValueT, KeyInfoT, BucketT>::LookupBucketFor(const LookupKeyT&, const BucketT*&) const [with LookupKeyT = clang::Stmt*; DerivedT = llvm::DenseMap<clang::Stmt*, long unsigned int>; KeyT = clang::Stmt*; ValueT = long unsigned int; KeyInfoT = llvm::DenseMapInfo<clang::Stmt*>; BucketT = llvm::detail::DenseMapPair<clang::Stmt*, long unsigned int>]: Assertion `!KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, TombstoneKey) && "Empty/Tombstone value shouldn't be inserted into map!"' failed. llvm-svn: 279045
* Support object-file-wrapped modules in clang -module-file-info.Adrian Prantl2016-08-171-13/+17
| | | | | | rdar://problem/24504815 llvm-svn: 279004
* [OpenMP] Sema and parsing for 'teams distribute simd’ pragmaKelvin Li2016-08-173-0/+19
| | | | | | | | | | This patch is to implement sema and parsing for 'teams distribute simd’ pragma. This patch is originated by Carlo Bertolli. Differential Revision: https://reviews.llvm.org/D23528 llvm-svn: 279003
* Module debug info: Fix a bug in handling record decls without fields.Adrian Prantl2016-08-171-5/+8
| | | | | | | | | | | The previous condition would erroneously mark all CXXRecordDecls that didn't have any fields as being defined in a clang module. This patch fixes the condition to only apply to explicit template instantiations. <rdar://problem/27771823> llvm-svn: 278952
* Debug info: Mark noreturn functions with DIFlagNoReturn.Adrian Prantl2016-08-171-0/+3
| | | | | | | | | | | This affects functions with the C++11 [[ noreturn ]] and C11 _Noreturn specifiers. Patch by Victor Leschuk! https://reviews.llvm.org/D23168 llvm-svn: 278942
* [ThinLTO] Adapt backend invocation to llvm API changes.Mehdi Amini2016-08-171-4/+18
| | | | | | | | | | Reviewers: tejohnson Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D23579 llvm-svn: 278906
* CodeGen: Avoid dereferencing end() in ↵Duncan P. N. Exon Smith2016-08-171-3/+2
| | | | | | | | | | ScalarExprEmitter::EmitOverflowCheckedBinOp Use BB.getNextNode(), which returns nullptr on end(), instead of &*BB.getIterator(), which is UB on end(). CodeGenFunction::createBasicBlock expects nullptr in this case already. llvm-svn: 278898
* [PM] Update Clang for LLVM's r278896 which re-organized a header.Chandler Carruth2016-08-171-2/+3
| | | | | | (sorry this didn't get landed closer in time...) llvm-svn: 278897
* Emit debug info for dynamic classes if they are imported from a DLL.Adrian McCarthy2016-08-161-1/+6
| | | | | | | | | | With -debug-info-kind=limited, we omit debug info for dynamic classes that live in other TUs. This reduces duplicate type information. When statically linked, the type information comes together. But if your binary has a class derived from a base in a DLL, the base class info is not available to the debugger. The decision is made in shouldOmitDefinition (CGDebugInfo.cpp). Per a suggestion from rnk, I've tweaked the decision so that we do include definitions for classes marked as DLL imports. This should be a relatively small number of classes, so we don't pay a large price for duplication of the type info, yet it should cover most cases on Windows. Essentially this makes debug info for DLLs independent, but we still assume that all TUs within the same DLL will be consistently built with (or without) debug info and the debugger will be able to search across the debug info within that scope to resolve any declarations into definitions, etc. llvm-svn: 278861
* Revert "[X86] Add xgetbv/x[X86] Add xgetbv xsetbv intrinsics to non-windows ↵Reid Kleckner2016-08-161-5/+1
| | | | | | | | platforms" This reverts commit r278783. It breaks usage of _xgetbv on Windows. llvm-svn: 278814
* Left shifts of negative values are defined if -fwrapv is setJames Molloy2016-08-161-1/+2
| | | | | | | This means we shouldn't emit ubsan detection code or warn. Fixes PR25552. llvm-svn: 278786
* [X86] Add xgetbv/x[X86] Add xgetbv xsetbv intrinsics to non-windows platformsMarina Yatsina2016-08-161-1/+5
| | | | | | | | commit on behalf of guyblank Differential Revision: https://reviews.llvm.org/D21959 llvm-svn: 278783
* Add the notion of deferred diagnostics.Justin Lebar2016-08-152-0/+41
| | | | | | | | | | | | | | | | | | | Summary: This patch lets you create diagnostics that are emitted if and only if a particular FunctionDecl is codegen'ed. This is necessary for CUDA, where some constructs -- e.g. calls from host+device functions to host functions when compiling for device -- are allowed to appear in semantically-correct programs, but only if they're never codegen'ed. Reviewers: rnk Subscribers: cfe-commits, tra Differential Revision: https://reviews.llvm.org/D23241 llvm-svn: 278735
* [CodeGen] Ignore unnamed bitfields before handling vector fieldsDavid Majnemer2016-08-151-4/+5
| | | | | | | | | | | | We processed unnamed bitfields after our logic for non-vector field elements in records larger than 128 bits. The vector logic would determine that the bit-field disqualifies the record from occupying a register despite the unnamed bit-field not participating in the record size nor its alignment. N.B. This behavior matches GCC and ICC. llvm-svn: 278656
* [CodeGen] Correctly implement the AVX512 psABI rulesDavid Majnemer2016-08-151-7/+10
| | | | | | | | | | | | | | An __m512 vector type wrapped in a structure should be passed in a vector register. Our prior implementation was based on a draft version of the psABI. This fixes PR28975. N.B. The update to the ABI was made here: https://github.com/hjl-tools/x86-psABI/commit/30f9c9 llvm-svn: 278655
* P0217R3: code generation support for decomposition declarations.Richard Smith2016-08-153-3/+17
| | | | llvm-svn: 278642
* [CUDA] Place GPU binary into .nv_fatbin section and align it by 8.Artem Belevich2016-08-121-1/+10
| | | | | | | | | This matches the way nvcc encapsulates GPU binaries into host object file. Now cuobjdump can deal with clang-compiled object files. Differential Revision: https://reviews.llvm.org/D23429 llvm-svn: 278549
* CodeGen: Replace ThinLTO backend implementation with a client of LTO/Resolution.Teresa Johnson2016-08-122-33/+65
| | | | | | | | | | | | | | | | Summary: This changes clang to use the llvm::lto::thinBackend function instead of its own less comprehensive ThinLTO backend implementation. Patch by Peter Collingbourne Reviewers: tejohnson, mehdi_amini Subscribers: cfe-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D21545 llvm-svn: 278541
* [OpenCL] Change block descriptor address space to constant.Joey Gouly2016-08-101-2/+10
| | | | | | | The block descriptor is a GlobalVariable in the LLVM IR, so it shouldn't be in the private address space. llvm-svn: 278234
* [x86] Fix a really nasty bug introduced in r276417 where alignmentChandler Carruth2016-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | constraints were added to _mm256_broadcast_{pd,ps} intel intrinsics. The spec for these intrinics is ... pretty much silent on alignment. This is especially frustrating considering the amount of discussion of alignment in the load and store instrinsics. So I was forced to rely on the specification for the VBROADCASTF128 instruction. That instruction's spec is *also* completely silent on alignment. Fortunately, when it comes to the instruction's spec, silence is enough. There is no #GP fault option for an underaligned address so this instruction, and by inference the intrinsic, can read any alignment. As it happens, the old code worked exactly this way and in fact we have plenty of code that hands pointers with less than 16-byte alignment to these intrinsics. This code broke pretty spectacularly with this commit. Fortunately, the fix is super simple! Change a 16 to a 1, and ta da! Anyways, a lot of debugging for a really boring fix. =] llvm-svn: 278202
* [OpenCL] Handle -cl-fp32-correctly-rounded-divide-sqrtYaxun Liu2016-08-092-2/+10
| | | | | | | | Let the driver pass the option to frontend. Do not set precision metadata for division instructions when this option is set. Set function attribute "correctly-rounded-divide-sqrt-fp-math" based on this option. Differential Revision: https://reviews.llvm.org/D22940 llvm-svn: 278155
* Revert "[Attr] Add support for the `ms_hook_prologue` attribute."Charles Davis2016-08-081-8/+0
| | | | | | | This reverts commit r278050. It depends on r278048, which will be reverted. llvm-svn: 278052
* [Attr] Add support for the `ms_hook_prologue` attribute.Charles Davis2016-08-081-0/+8
| | | | | | | | | | | | | | | | | | | | | | | Summary: Based on a patch by Michael Mueller. This attribute specifies that a function can be hooked or patched. This mechanism was originally devised by Microsoft for hotpatching their binaries (which they're constantly updating to stay ahead of crackers, script kiddies, and other ne'er-do-wells on the Internet), but it's now commonly abused by Windows programs that want to hook API functions. It is for this reason that this attribute was added to GCC--hence the name, `ms_hook_prologue`. Depends on D19908. Reviewers: rnk, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D19909 llvm-svn: 278050
* [ARM] Command-line options for embedded position-independent codeOliver Stannard2016-08-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch (with the corresponding ARM backend patch) adds support for some new relocation models: * Read-only position independence (ROPI): Code and read-only data is accessed PC-relative. The offsets between all code and RO data sections are known at static link time. * Read-write position independence (RWPI): Read-write data is accessed relative to a static base register. The offsets between all writeable data sections are known at static link time. These two modes are independent (they specify how different objects should be addressed), so they can be used individually or together. These modes are intended for bare-metal systems or systems with small real-time operating systems. They are designed to avoid the need for a dynamic linker, the only initialisation required is setting the static base register to an appropriate value for RWPI code. There is one C construct not currently supported by these modes: global variables initialised to the address of another global variable or function, where that address is not known at static-link time. There are a few possible ways to solve this: * Disallow this, and require the user to write their own initialisation function if they need variables like this. * Emit dynamic initialisers for these variables in the compiler, called from the .init_array section (as is currently done for C++ dynamic initialisers). We have a patch to do this, described in my original RFC email (http://lists.llvm.org/pipermail/llvm-dev/2015-December/093022.html), but the feedback from that RFC thread was that this is not something that belongs in clang. * Use a small dynamic loader to fix up these variables, by adding the difference between the load and execution address of the relevant section. This would require linker co-operation to generate a table of addresses that need fixing up. Differential Revision: https://reviews.llvm.org/D23196 llvm-svn: 278016
* PR26423: Assert on valid use of using declaration of a function with an ↵David Blaikie2016-08-051-0/+10
| | | | | | | | | | | | undeduced auto return type For now just disregard the using declaration in this case. Suboptimal, but wiring up the ability to have declarations of functions that are separate from their definition (we currently only do that for member functions) and have differing return types (we don't have any support for that) is more work than seems reasonable to at least fix this crash. llvm-svn: 277852
* AMDGPU : Add Clang builtin intrinsics for compare with the fullWei Ding2016-08-051-0/+8
| | | | | | | | wavefront result. Differential Revision: http://reviews.llvm.org/D22934 llvm-svn: 277824
* [OpenMP] Sema and parsing for 'teams distribute' pragmaKelvin Li2016-08-053-0/+16
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute' pragma. Differential Revision: https://reviews.llvm.org/D23189 llvm-svn: 277818
* [OpenCL] Added underscores to the names of 'to_addr' OpenCL built-ins.Alexey Bader2016-08-041-2/+3
| | | | | | | | | | | | | | | Summary: In order to re-define OpenCL built-in functions 'to_{private,local,global}' in OpenCL run-time library LLVM names must be different from the clang built-in function names. Reviewers: yaxunl, Anastasia Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23120 llvm-svn: 277743
* [OpenCL] Fix size of image typeYaxun Liu2016-08-033-14/+2
| | | | | | | | | | The size of image type is reported incorrectly as size of a pointer to address space 0, which causes error when casting image type to pointers by __builtin_astype. The fix is to get image address space from TargetInfo then report the size accordingly. Differential Revision: https://reviews.llvm.org/D22927 llvm-svn: 277647
* Add FIXMEs for MSVC 2013 hacks in r277211. NFC.Paul Robinson2016-08-011-0/+5
| | | | llvm-svn: 277396
* CodeGen: simplify the CC handling for TLS wrappersSaleem Abdulrasool2016-08-011-2/+1
| | | | | | | | | Use the calling convention of the wrapper directly to set the calling convention to ensure that the calling convention matches. Incorrectly setting the calling convention results in the code path being entirely nullified as InstCombine + SimplifyCFG will prune the mismatched CC calls. llvm-svn: 277390
* [codeview] Skip injected class names in nested record emissionReid Kleckner2016-08-011-0/+3
| | | | | | | | We were already trying to do this, but our check wasn't quite right. Fixes PR28790 llvm-svn: 277367
* Fix VS2013 build of CGOpenMPRuntime.cppHans Wennborg2016-07-301-3/+7
| | | | | | | | It seems the compiler was getting confused by the in-class initializers in local struct MapInfo, so moving those to a default constructor instead. llvm-svn: 277256
* Fix CGOpenMPRuntime.cpp for VS2013. NFC.Paul Robinson2016-07-291-10/+11
| | | | | | I don't know why these changes work but they do. llvm-svn: 277211
* CodeGen: try harder to make the CFString structure RWSaleem Abdulrasool2016-07-291-1/+1
| | | | | | | | The previous change was insufficient to mark the content as read-write as the structure itself was marked constant. Adjust this and add tests to ensure that the section is marked appropriately as being read-write. llvm-svn: 277200
* Initial vectorization support for svml calls (short vector math library).Matt Masten2016-07-291-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D19544 llvm-svn: 277167
* [OpenCL] Generate opaque type for sampler_t and function call for the ↵Yaxun Liu2016-07-2811-7/+47
| | | | | | | | | | | | | | | | initializer Currently Clang use int32 to represent sampler_t, which have been a source of issue for some backends, because in some backends sampler_t cannot be represented by int32. They have to depend on kernel argument metadata and use IPA to find the sampler arguments and global variables and transform them to target specific sampler type. This patch uses opaque pointer type opencl.sampler_t* for sampler_t. For each use of file-scope sampler variable, it generates a function call of __translate_sampler_initializer. For each initialization of function-scope sampler variable, it generates a function call of __translate_sampler_initializer. Each builtin library can implement its own __translate_sampler_initializer(). Since the real sampler type tends to be architecture dependent, allowing it to be initialized by a library function simplifies backend design. A typical implementation of __translate_sampler_initializer could be a table lookup of real sampler literal values. Since its argument is always a literal, the returned pointer is known at compile time and easily optimized to finally become some literal values directly put into image read instructions. This patch is partially based on Alexey Sotkin's work in Khronos Clang (https://github.com/KhronosGroup/SPIR/commit/3d4eec61623502fc306e8c67c9868be2b136e42b). Differential Revision: https://reviews.llvm.org/D21567 llvm-svn: 277024
* [OpenMP] Change name of variable in mappble expression.Samuel Antao2016-07-281-7/+7
| | | | | | This attempts to fix a failure in Windows bots pottentially related with a reserved keyword. llvm-svn: 276988
* [OpenMP] Do not use default argument in lambda from mappable expressions ↵Samuel Antao2016-07-281-4/+7
| | | | | | | | handlers. Windows bots were complaining about that. llvm-svn: 276981
* [OpenMP] Code generation for the is_device_ptr clauseSamuel Antao2016-07-281-4/+40
| | | | | | | | | | | | Summary: This patch adds support for the is_device_ptr clause. It expands SEMA to use the mappable expression logic that can only be tested with code generation in place and check conflicts with other data sharing related clauses using the mappable expressions infrastructure. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: https://reviews.llvm.org/D22788 llvm-svn: 276978
OpenPOWER on IntegriCloud