summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[OPENMP] Fixed codegen for 'omp cancel' construct."Vitaly Buka2016-11-162-63/+6
| | | | | | | | | | | | | | | | Summary: r286944 introduced bugs detected by ASAN as use-after-return. r287025 have not fixed them completely. This reverts commit r286944 and r287025. Reviewers: ABataev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26720 llvm-svn: 287069
* Revert "Improve handling of __FUNCTION__ and other predefined expression for ↵Mehdi Amini2016-11-151-13/+3
| | | | | | | | Objective-C Blocks" This reverts commit r287039, tests are broken. llvm-svn: 287043
* Improve handling of __FUNCTION__ and other predefined expression for ↵Mehdi Amini2016-11-151-3/+13
| | | | | | | | | | | Objective-C Blocks Instead of always displaying the mangled name, try to do better and get something closer to regular functions. Differential Revision: https://reviews.llvm.org/D26522 llvm-svn: 287039
* [OPENMP] Fix stack use after delete, NFC.Alexey Bataev2016-11-151-5/+4
| | | | | | Fixed possible use of stack variable after deletion. llvm-svn: 287025
* vector load store with length (left justified) clang portionZaara Syeda2016-11-151-7/+32
| | | | llvm-svn: 286994
* [PowerPC] Implement BE VSX load/store builtins - clang portion.Tony Jiang2016-11-151-2/+18
| | | | | | | | | | | | This patch implements all the overloads for vec_xl_be and vec_xst_be. On BE, they behaves exactly the same with vec_xl and vec_xst, therefore they are simply implemented by defining a matching macro. On LE, they are implemented by defining new builtins and intrinsics. For int/float/long long/double, it is just a load (lxvw4x/lxvd2x) or store(stxvw4x/stxvd2x). For char/char/short, we also need some extra shuffling before or after call the builtins to get the desired BE order. For int128, simply call vec_xl or vec_xst. llvm-svn: 286971
* [OPENMP] Fixed codegen for 'omp cancel' construct.Alexey Bataev2016-11-152-6/+64
| | | | | | | | | If 'omp cancel' construct is used in a worksharing construct it may cause hanging of the software in case if reduction clause is used. Patch fixes this problem by avoiding extra reduction processing for branches that were canceled. llvm-svn: 286944
* [OpenCL] Fix for integer parameters of enqueue_kernelAnastasia Stulova2016-11-141-23/+13
| | | | | | | | | | | | | | Make handling integer parameters more flexible: - For the number of events argument allow to pass larger integers than 32 bits as soon as compiler can prove that the range fits in 32 bits. If not, the diagnostic will be given. - Change type of the arguments specifying the sizes of the corresponding block arguments to be size_t. Review: https://reviews.llvm.org/D26509 llvm-svn: 286849
* [OpenCL] Change to clk_event parameter in enqueue_kernel.Anastasia Stulova2016-11-141-13/+9
| | | | | | | | | - Accept NULL pointer as a valid parameter value for clk_event. - Generate clk_event_t arguments of internal __enqueue_kernel_XXX function as pointers in generic address space. Review: https://reviews.llvm.org/D26507 llvm-svn: 286836
* [OpenCL] always use SPIR address spaces for kernel_arg_addr_space MDPekka Jaaskelainen2016-11-141-3/+19
| | | | | | | | | | | | | | | It doesn't make sense to use the target's address space ids in this context as this is metadata that should be referring to the "logical" OpenCL address spaces. For flat AS machines like all "CPUs" in general, the logical AS info gets lost as there's only one address space (0). This commit changes the logic such that we always use the SPIR address space ids for the argument metadata. It thus allows implementing the clGetKernelArgInfo() and the other detection needs. https://reviews.llvm.org/D26157 llvm-svn: 286819
* Bitcode: Change module reader functions to return an llvm::Expected.Peter Collingbourne2016-11-132-5/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D26562 llvm-svn: 286752
* [AMDGPU] Add f16 builtin functions (VI+)Konstantin Zhuravlyov2016-11-131-4/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D26476 llvm-svn: 286741
* [tsan][clang] Introduce a function attribute to disable TSan checking at run ↵Anna Zaks2016-11-111-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | time This introduces a function annotation that disables TSan checking for the function at run time. The benefit over attribute((no_sanitize("thread"))) is that the accesses within the callees will also be suppressed. The motivation for this attribute is a guarantee given by the objective C language that the calls to the reference count decrement and object deallocation will be synchronized. To model this properly, we would need to intercept all ref count decrement calls (which are very common in ObjC due to use of ARC) and also every single message send. Instead, we propose to just ignore all accesses made from within dealloc at run time. The main downside is that this still does not introduce any synchronization, which means we might still report false positives if the code that relies on this synchronization is not executed from within dealloc. However, we have not seen this in practice so far and think these cases will be very rare. (This problem is similar in nature to https://reviews.llvm.org/D21609; unfortunately, the same solution does not apply here.) Differential Revision: https://reviews.llvm.org/D25857 llvm-svn: 286672
* Bitcode: Change getModuleSummaryIndex() to return an llvm::Expected.Peter Collingbourne2016-11-111-8/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D26539 llvm-svn: 286624
* [X86] Merge (near) duplicate scalar non-temporal store code. NFCI.Simon Pilgrim2016-11-111-20/+10
| | | | llvm-svn: 286595
* Mirror the llvm changes that split Bitcode/ReaderWriter.hTeresa Johnson2016-11-113-3/+4
| | | | | | | | | | The change in D26502 splits ReaderWriter.h, which contains the APIs into both the BitReader and BitWriter libraries, into BitcodeReader.h and BitcodeWriter.h. Change clang uses to the appropriate split header(s). llvm-svn: 286567
* PR30937: don't devirtualize if we find that the callee is a pure virtualRichard Smith2016-11-111-23/+20
| | | | | | | | function. In that case, there is no requirement that the callee is actually defined, and the code may in fact be valid and have defined behavior if the virtual call is unreachable. llvm-svn: 286534
* Accept nullability qualifiers on array parameters.Jordan Rose2016-11-101-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since array parameters decay to pointers, '_Nullable' and friends should be available for use there as well. This is especially important for parameters that are typedefs of arrays. The unsugared syntax for this follows the syntax for 'static'-sized arrays in C: void test(int values[_Nullable]); This syntax was previously accepted but the '_Nullable' (and any other attributes) were silently discarded. However, applying '_Nullable' to a typedef was previously rejected and is now accepted; therefore, it may be necessary to test for the presence of this feature: #if __has_feature(nullability_on_arrays) One important change here is that DecayedTypes don't always immediately contain PointerTypes anymore; they may contain an AttributedType instead. This only affected one place in-tree, so I would guess it's not likely to cause problems elsewhere. This commit does not change -Wnullability-completeness just yet. I want to think about whether it's worth doing something special to avoid breaking existing clients that compile with -Werror. It also doesn't change '#pragma clang assume_nonnull' behavior, which currently treats the following two declarations as equivalent: #pragma clang assume_nonnull begin void test(void *pointers[]); #pragma clang assume_nonnull end void test(void * _Nonnull pointers[]); This is not the desired behavior, but changing it would break backwards-compatibility. Most likely the best answer is going to be adding a new warning. Part of rdar://problem/25846421 llvm-svn: 286519
* Add the loop end location to the loop metadata. This additional informationAmara Emerson2016-11-108-26/+65
| | | | | | | | | | | | can be used to improve the locations when generating remarks for loops. Depends on the companion LLVM change r286227. Patch by Florian Hahn. Differential Revision: https://reviews.llvm.org/D25764 llvm-svn: 286456
* Use an artificial debug location for non-virtual thunks.Adrian Prantl2016-11-092-5/+9
| | | | | | | | | Thunks are artificial and have no corresponding source location except for the line number on the DISubprogram, which is marked as artificial. <rdar://problem/11941095> llvm-svn: 286400
* Emit debug info for global constants whose address is taken exactly once.Adrian Prantl2016-11-091-0/+7
| | | | | | | | | Add a check to the DeclCache before emitting debug info for a GlobalVariable a second time and just attach the previsously created one to it. <rdar://problem/26721101> llvm-svn: 286322
* [X86][AVX512][Clang] Add support for mask_{move|store|load}_s{s/d} and ↵Ayman Musa2016-11-081-0/+8
| | | | | | | | int2mask/mask2int intrinsics. Differential Revision: https://reviews.llvm.org/D26021 llvm-svn: 286229
* IR, Bitcode: Change bitcode reader to no longer own its memory buffer.Peter Collingbourne2016-11-081-1/+1
| | | | | | | | | | | | | | | | | | Unique ownership is just one possible ownership pattern for the memory buffer underlying the bitcode reader. In practice, as this patch shows, ownership can often reside at a higher level. With the upcoming change to allow multiple modules in a single bitcode file, it will no longer be appropriate for modules to generally have unique ownership of their memory buffer. The C API exposes the ownership relation via the LLVMGetBitcodeModuleInContext and LLVMGetBitcodeModuleInContext2 functions, so we still need some way for the module to own the memory buffer. This patch does so by adding an owned memory buffer field to Module, and using it in a few other places where it is convenient. Differential Revision: https://reviews.llvm.org/D26384 llvm-svn: 286214
* Bitcode: Decouple block info block state from reader.Peter Collingbourne2016-11-081-7/+7
| | | | | | | | | | | | | | | | | As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106630.html Move block info block state to a new class, BitstreamBlockInfo. Clients may set the block info for a particular cursor with the BitstreamCursor::setBlockInfo() method. At this point BitstreamReader is not much more than a container for an ArrayRef<uint8_t>, so remove it and replace all uses with direct uses of memory buffers. Differential Revision: https://reviews.llvm.org/D26259 llvm-svn: 286207
* Make a const variable static. NFC.George Burgess IV2016-11-081-1/+1
| | | | llvm-svn: 286201
* Name some anonymous structs to avoid using a (very common) extension.John McCall2016-11-071-7/+10
| | | | llvm-svn: 286152
* Use -fsanitize-recover instead of -mllvm -msan-keep-going: clang.Evgeniy Stepanov2016-11-071-1/+3
| | | | | | | | | | | | | | Summary: Use -fsanitize-recover instead of -mllvm -msan-keep-going: pass -fsanitize-recover value to msan. Reviewers: eugenis Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26354 Patch by Aleksey Shlyapnikov. llvm-svn: 286148
* [OPENMP] Fixed codegen for __real/__imag expressions in atomicAlexey Bataev2016-11-071-2/+4
| | | | | | | | | | | | constructs. For __real/__imag unary expressions clang emits lvalue with the associated type from the original complex expression, but not the underlying builtin integer or float type. This causes crash in codegen for atomic constructs, if __real/__imag expression are used in atomic constructs. llvm-svn: 286129
* Fix use-of-temporary with StringRef in code coverageJordan Rose2016-11-071-2/+7
| | | | | | | | | | | | | The fixed code is basically identical to the same loop below, which might indicate an opportunity for refactoring. I just wanted to fix the use-of-temporary issue. Caught by adding a similar check to StringRef as r283798 did for ArrayRef. I'll be upstreaming that soon. Reviewed by Vedant Kumar as https://reviews.llvm.org/D26317. llvm-svn: 286122
* [OPENMP] Fixed capturing of VLA variables.Alexey Bataev2016-11-072-7/+6
| | | | | | After some changes in codegen capturing of VLA variables in OpenMP regions was broken, causing compiler crash. Patch fixes this issue. llvm-svn: 286103
* Revert "[OPENMP] Fixed capturing of VLA variables."Diana Picus2016-11-072-6/+7
| | | | | | | This reverts commit r286098 because the modified test breaks on many of the buildbots. llvm-svn: 286102
* [OPENMP] Fixed capturing of VLA variables.Alexey Bataev2016-11-072-7/+6
| | | | | | | After some changes in codegen capturing of VLA variables in OpenMP regions was broken, causing compiler crash. Patch fixes this issue. llvm-svn: 286098
* Add debug info support for C++11 inline namespaces.Adrian Prantl2016-11-031-2/+2
| | | | | | <rdar://problem/18616046> llvm-svn: 285960
* Improve obvious-most-derived-type devirtualization:Richard Smith2016-11-031-37/+15
| | | | | | | | | | | | | | * if the base is produced by a series of derived-to-base conversions, check the expression inside them when looking for an expression with a known dynamic type * step past MaterializeTemporaryExprs when checking for a known dynamic type * when checking for a known dynamic type, treat all class prvalues as having a known dynamic type after skipping all relevant rvalue subobject adjustments * treat callees formed by pointer-to-member access for a non-reference member type like callees formed by member access. llvm-svn: 285954
* [CodeGen] Use StringRef. NFC.George Burgess IV2016-11-033-7/+7
| | | | | | | | Looks like CurFn's name outlives FunctionName, so we can just pass StringRefs around rather than going from a StringRef to a std::string to a const char* to a StringRef. llvm-svn: 285873
* regcall: Implement regcall Calling Conv in clangErich Keane2016-11-024-27/+140
| | | | | | | | | | This patch implements the register call calling convention, which ensures as many values as possible are passed in registers. CodeGen changes were committed in https://reviews.llvm.org/rL284108. Differential Revision: https://reviews.llvm.org/D25204 llvm-svn: 285849
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-022-4/+3
| | | | | | | | | | Reviewers: aaron.ballman, mehdi_amini, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26206 llvm-svn: 285799
* Bitcode: Change reader interface to take memory buffers.Peter Collingbourne2016-11-021-4/+3
| | | | | | | | | | | | | | | | | | | As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106595.html This change also fixes an API oddity where BitstreamCursor::Read() would return zero for the first read past the end of the bitstream, but would report_fatal_error for subsequent reads. Now we always report_fatal_error for all reads past the end. Updated clients to check for the end of the bitstream before reading from it. I also needed to add padding to the invalid bitcode tests in test/Bitcode/. This is because the streaming interface was not checking that the file size is a multiple of 4. Differential Revision: https://reviews.llvm.org/D26219 llvm-svn: 285773
* [OpenCL] Mark group functions as convergent in opencl-c.hYaxun Liu2016-11-011-0/+2
| | | | | | | | | | Certain OpenCL builtin functions are supposed to be executed by all threads in a work group or sub group. Such functions should not be made divergent during transformation. It makes sense to mark them with convergent attribute. The adding of convergent attribute is based on Ettore Speziale's work and the original proposal and patch can be found at https://www.mail-archive.com/cfe-commits@lists.llvm.org/msg22271.html. Differential Revision: https://reviews.llvm.org/D25343 llvm-svn: 285725
* Implement ABI proposal for throwing noexcept function pointers, per discussionRichard Smith2016-11-011-4/+109
| | | | | | | | on cxx-abi-dev (thread starting 2016-10-11). This is currently hidden behind a cc1-only -m flag, pending discussion of how best to deal with language changes that require use of new symbols from the ABI library. llvm-svn: 285664
* [cfi] Fix missing !type annotation.Evgeniy Stepanov2016-10-311-5/+9
| | | | | | | CFI (only in the cross-dso mode) fails to set !type annotations when a function is used before it is defined. llvm-svn: 285650
* DebugInfo: support for DW_TAG_atomic_typeVictor Leschuk2016-10-311-3/+2
| | | | | | | | Mark C11 _Atomic variables with DW_TAG_atomic_type tag. Differential Revision: https://reviews.llvm.org/D26145 llvm-svn: 285625
* Use toCharUnitsFromBits instead of TargetInfo::getCharWidthDavid Majnemer2016-10-311-6/+8
| | | | llvm-svn: 285595
* [OpenCL] Setting constant address space for array initializersAlexey Bader2016-10-311-1/+7
| | | | | | | | | | | | | | Summary: Setting constant address space for global constants used for memcpy-initialization of arrays. Patch by Alexey Sotkin. Reviewers: bader, yaxunl, Anastasia Subscribers: cfe-commits, AlexeySotkin Differential Revision: https://reviews.llvm.org/D25305 llvm-svn: 285557
* Add support for __builtin_alloca_with_alignDavid Majnemer2016-10-311-0/+13
| | | | | | | | | | __builtin_alloca always uses __BIGGEST_ALIGNMENT__ for the alignment of the allocation. __builtin_alloca_with_align allows the programmer to specify the alignment of the allocation. This fixes PR30658. llvm-svn: 285544
* [Devirtualization] Decorate vfunction load with invariant.loadPiotr Padlewski2016-10-291-1/+16
| | | | | | | | | | | | | | | | Summary: This patch was introduced one year ago, but because my google account was disabled, I didn't get email with failing buildbot and I missed revert of this commit. There was small but in test regex. I am back. Reviewers: rsmith, rengolin Subscribers: nlewycky, rjmccall, cfe-commits Differential Revision: https://reviews.llvm.org/D26117 llvm-svn: 285497
* [CodeGen] Provide an appropriate alignment for dynamic allocasDavid Majnemer2016-10-271-1/+7
| | | | | | | | | | | | | | GCC documents __builtin_alloca as aligning the storage to at least __BIGGEST_ALIGNMENT__. MSVC documents essentially the same for the x64 ABI: https://msdn.microsoft.com/en-us/library/x9sx5da1.aspx The 32-bit ABI follows the same rule: it emits a call to _alloca_probe_16 Differential Revision: https://reviews.llvm.org/D24378 llvm-svn: 285316
* [MS ABI] Reuse getVFPtrOffsets instead of using getClassAtVTableLocationDavid Majnemer2016-10-271-40/+16
| | | | | | | | | | | | getClassAtVTableLocation hunts through virtual bases without using the MDC layout which is indicative of a bug. Instead, reuse the getVFPtrOffsets machinery to calculate which subobject within the MDC is responsible for the vfptr. Differential Revision: https://reviews.llvm.org/D25895 llvm-svn: 285315
* [coroutines] Add allocation and deallocation substatements.Gor Nishanov2016-10-273-4/+23
| | | | | | | | | | | | | | Summary: SemaCoroutine: Add allocation / deallocation substatements. CGCoroutine/Test: Emit allocation and deallocation + test. Reviewers: rsmith Subscribers: ABataev, EricWF, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D25879 llvm-svn: 285306
* Empty the CtorLists/DtorLists once emitted.Vassil Vassilev2016-10-272-5/+6
| | | | | | | | | | | This is essential when clang is running in incremental processing mode because we don't want to reemit the 'tors over and over again. Patch by Axel Naumann! Reviewed by Richard Smith and me. (https://reviews.llvm.org/D25605) llvm-svn: 285277
OpenPOWER on IntegriCloud