summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Refactor call emission to package the function pointer together withJohn McCall2016-10-2623-327/+620
| | | | | | | | | | | abstract information about the callee. NFC. The goal here is to make it easier to recognize indirect calls and trigger additional logic in certain cases. That logic will come in a later patch; in the meantime, I felt that this was a significant improvement to the code. llvm-svn: 285258
* [CodeGen] Don't emit lifetime intrinsics for some local variablesVitaly Buka2016-10-266-6/+263
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Current generation of lifetime intrinsics does not handle cases like: ``` { char x; l1: bar(&x, 1); } goto l1; ``` We will get code like this: ``` %x = alloca i8, align 1 call void @llvm.lifetime.start(i64 1, i8* nonnull %x) br label %l1 l1: %call = call i32 @bar(i8* nonnull %x, i32 1) call void @llvm.lifetime.end(i64 1, i8* nonnull %x) br label %l1 ``` So the second time bar was called for x which is marked as dead. Lifetime markers here are misleading so it's better to remove them at all. This type of bypasses are rare, e.g. code detects just 8 functions building clang (2329 targets). PR28267 Reviewers: eugenis Subscribers: beanz, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D24693 llvm-svn: 285176
* [CodeGen] Move shouldEmitLifetimeMarkers into more convenient placeVitaly Buka2016-10-263-28/+31
| | | | | | | | | | | | Summary: D24693 will need access to it from other places Reviewers: eugenis Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24695 llvm-svn: 285158
* [codeview] emit debug info for indirect virtual base classesBob Haarman2016-10-252-9/+40
| | | | | | | | | | | | | | | Summary: Fixes PR28281. MSVC lists indirect virtual base classes in the field list of a class. This change makes Clang emit the information necessary for LLVM to emit such records. Reviewers: rnk, ruiu, zturner Differential Revision: https://reviews.llvm.org/D25579 llvm-svn: 285132
* CodeGen: be more conservative about setting sectionSaleem Abdulrasool2016-10-251-29/+44
| | | | | | | The section names currently are MachO specific. Only set the section on the variables if the file format is MachO. llvm-svn: 285126
* CodeGen: mark protocols as common dataSaleem Abdulrasool2016-10-251-12/+30
| | | | | | | | This allows for the coalescing of the protocol declarations. When the protocols are declared in headers, multiple definitions of the protocol would be emitted. Marking them as common data indicates that any one can be selected. llvm-svn: 285073
* Re-apply patch r279045.Kelvin Li2016-10-253-0/+19
| | | | llvm-svn: 285066
* Add dependency from clangCodeGen to clangAnalysisMehdi Amini2016-10-241-0/+1
| | | | | | This is unbreaking the build with shared library after r285019. llvm-svn: 285042
* Link clangCodeGen with clangAnalysis required after r284990.Artem Belevich2016-10-241-0/+1
| | | | | | Fixes build break for configurations that use shared libraries. llvm-svn: 285037
* CodeGen: remove incorrect temporary TwineSaleem Abdulrasool2016-10-241-2/+2
| | | | | | Twines should not be stack allocated. This somehow managed to get past me. llvm-svn: 285028
* CodeGen: centralise label construction for method listsSaleem Abdulrasool2016-10-241-59/+107
| | | | | | | | | | | Move all the label construction for the various method list emission into EmitMethodList. Rather than have all the names be constructed in pieces in all of the callers of EmitMethodList, have this occur in one site. This also makes the calls much easier to understand as we simplify identify the type of the method list being emitted and the interface name for which it is being emitted. NFC. llvm-svn: 285023
* Add support for __builtin_os_log_format[_buffer_size]Mehdi Amini2016-10-241-1/+84
| | | | | | | | | | | | | | | | | This reverts commit r285007 and reapply r284990, with a fix for the opencl test that I broke. Original commit message follows: These new builtins support a mechanism for logging OS events, using a printf-like format string to specify the layout of data in a buffer. The _buffer_size version of the builtin can be used to determine the size of the buffer to allocate to hold the data, and then __builtin_os_log_format can write data into that buffer. This implements format checking to report mismatches between the format string and the data arguments. Most of this code was written by Chris Willmore. Differential Revision: https://reviews.llvm.org/D25888 llvm-svn: 285019
* Revert "Add support for __builtin_os_log_format[_buffer_size]"Mehdi Amini2016-10-241-84/+1
| | | | | | This reverts commit r284990, two opencl test are broken llvm-svn: 285007
* Add support for __builtin_os_log_format[_buffer_size]Mehdi Amini2016-10-241-1/+84
| | | | | | | | | | | | | | These new builtins support a mechanism for logging OS events, using a printf-like format string to specify the layout of data in a buffer. The _buffer_size version of the builtin can be used to determine the size of the buffer to allocate to hold the data, and then __builtin_os_log_format can write data into that buffer. This implements format checking to report mismatches between the format string and the data arguments. Most of this code was written by Chris Willmore. Differential Revision: https://reviews.llvm.org/D25888 llvm-svn: 284990
* [AVX-512] Replace 64-bit element and 512-bit vector pmin/pmax builtins with ↵Craig Topper2016-10-241-17/+44
| | | | | | native IR like we do for 128/256-bit, but with the addition of masking. llvm-svn: 284956
* [AVX-512] Remove masked 128/256-bit palignr builtins. We can just use a ↵Craig Topper2016-10-221-2/+0
| | | | | | select in the header file with the older unmasked versions instead. llvm-svn: 284920
* Switch SmallSetVector to use DenseSet when it overflows its inline space.Justin Lebar2016-10-211-3/+4
| | | | | | | | | | | | | | | | | | | | Summary: SetVector already used DenseSet, but SmallSetVector used std::set. This leads to surprising performance differences. Moreover, it means that the set of key types accepted by SetVector and SmallSetVector are quite different! In order to make this change, we had to convert some callsites that used SmallSetVector<std::string, N> to use SmallSetVector<CachedHashString, N> instead. Reviewers: timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25648 llvm-svn: 284887
* [CodeGen] Devirtualize calls to methods marked final in a derived classVedant Kumar2016-10-201-7/+15
| | | | | | | | | | If we see a virtual method call to Base::foo() but can infer that the object is an instance of Derived, and that 'foo' is marked 'final' in Derived, we can devirtualize the call to Derived::foo(). Differential Revision: https://reviews.llvm.org/D25813 llvm-svn: 284766
* Retire llvm::alignOf in favor of C++11 alignof.Benjamin Kramer2016-10-204-7/+6
| | | | | | No functionality change intended. llvm-svn: 284730
* DebugInfo: pass alignment value only if it was forcedVictor Leschuk2016-10-202-51/+85
| | | | | | | | | | Preparation to implement DW_AT_alignment support: - We pass non-zero align value to DIBuilder only when alignment was forced - Modify tests to match this change Differential Revision: https://reviews.llvm.org/D24426 llvm-svn: 284679
OpenPOWER on IntegriCloud