summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Add new llvm.loop.unroll.enable metadata for use with "#pragma unroll".Mark Heffernan2015-08-102-17/+30
| | | | | | | | | | | | | | | | | | | | | | This change adds the new unroll metadata "llvm.loop.unroll.enable" which directs the optimizer to unroll a loop fully if the trip count is known at compile time, and unroll partially if the trip count is not known at compile time. This differs from "llvm.loop.unroll.full" which explicitly does not unroll a loop if the trip count is not known at compile time With this change "#pragma unroll" generates "llvm.loop.unroll.enable" rather than "llvm.loop.unroll.full" metadata. This changes the semantics of "#pragma unroll" slightly to mean "unroll aggressively (fully or partially)" rather than "unroll fully or not at all". The motivating example for this change was some internal code with a loop marked with "#pragma unroll" which only sometimes had a compile-time trip count depending on template magic. When the trip count was a compile-time constant, everything works as expected and the loop is fully unrolled. However, when the trip count was not a compile-time constant the "#pragma unroll" explicitly disabled unrolling of the loop(!). Removing "#pragma unroll" caused the loop to be unrolled partially which was desirable from a performance perspective. llvm-svn: 244467
* [modules] PR22534: Load files specified by -fmodule-file= eagerly. In ↵Richard Smith2015-08-091-1/+6
| | | | | | particular, this avoids the need to re-parse module map files when using such a module. llvm-svn: 244416
* This patch commits OpenMP 4 target device clausesMichael Wong2015-08-071-0/+1
| | | | | | | This is committed on behalf of Kelvin Li http://reviews.llvm.org/D11469?id=31227 llvm-svn: 244325
* [ItaniumCXXABI] Don't import RTTI data for classes with key functionsDavid Majnemer2015-08-061-4/+14
| | | | | | | | | MinGW has some pretty strange behvaior around RTTI and dllimport/dllexport: - RTTI data is never imported - RTTI data is only exported if the class has no key function. llvm-svn: 244266
* [OPENMP 4.1] Allow references in init expression for loop-based constructs.Alexey Bataev2015-08-061-8/+18
| | | | | | OpenMP 4.1 allows to use variables with reference types in private clauses and, therefore, in init expressions of the cannonical loop forms. llvm-svn: 244209
* Mark calls in thunk functions as tail-call optimization candidatesMichael Kuperstein2015-08-061-0/+2
| | | | | | | | | | | | | When a thunk is generated with a call to the original adjusted function, the thunk appears in the debugger call stack. We want the backend to perform tail-call optimization on the call, to make it invisible to the debugger. This fixes PR24235 Patch by: amjad.aboud@intel.com Differential Revision: http://reviews.llvm.org/D11476 llvm-svn: 244207
* Rename the non-coding style conformant functions in namespace BuiltinsEric Christopher2015-08-062-3/+3
| | | | | | to match the rest of their brethren and reformat the bits that need it. llvm-svn: 244186
* Rename DescriptionString -> DataLayoutString as it matches the actualEric Christopher2015-08-053-7/+7
| | | | | | use of the string. llvm-svn: 244178
* Add -gcodeview and -gdwarf to control which type Clang emitsReid Kleckner2015-08-051-1/+6
| | | | | | | | | | | | | | | Summary: By default, 'clang' emits dwarf and 'clang-cl' emits codeview. You can force emission of one or both by passing -gcodeview and -gdwarf to either driver. Reviewers: dblaikie, hans Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11742 llvm-svn: 244097
* Add missing atomic libcall support.James Y Knight2015-08-051-3/+71
| | | | | | | | | | Support for emitting libcalls for __atomic_fetch_nand and __atomic_{add,sub,and,or,xor,nand}_fetch was missing; add it, and some test cases. Differential Revision: http://reviews.llvm.org/D10847 llvm-svn: 244063
* Don't repeat function names in comments. NFC.Filipe Cabecinhas2015-08-053-27/+23
| | | | llvm-svn: 244018
* [CodeGen] Fold memcpy into SmallVector initializer. No functionality change.Benjamin Kramer2015-08-041-3/+2
| | | | llvm-svn: 243992
* [CodeGen] Don't write into a SmallVector's uninitialized memory.Benjamin Kramer2015-08-041-7/+4
| | | | | | That's just ugly and not needed in this case. No functionality change. llvm-svn: 243973
* [UB] Another place where we were trying to put string data intoChandler Carruth2015-08-041-2/+4
| | | | | | | | | | | | | a BumpPtrAllocator. This at least now handles the case where there is no concatentation without calling memcpy on a null pointer. It might be interesting to handle the case where everything is empty without round-tripping through the allocator, but it wasn't clear to me if the pointer returned is significant in any way, so I've left it in a conservatively more-correct state. Again, found with UBSan. llvm-svn: 243948
* Dtor callback emitted when msan attribute not repressed for this function.Naomi Musgrave2015-08-031-1/+2
| | | | | | | | | | | | | | | | | | Summary: In addition to checking compiler flags, the front-end also examines the attributes of the destructor definition to ensure that the SanitizeMemory attribute is attached. Reviewers: eugenis, kcc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11727 refactored test into new file, revised how function attribute examined modified test to examine default dtor with and without attribute removed attribute check llvm-svn: 243912
* Fix invalid shufflevector operandsSimon Pilgrim2015-08-021-1/+12
| | | | | | | | | | This patch fixes bug 23800 ( https://llvm.org/bugs/show_bug.cgi?id=23800#c2 ). There existed a case where the index operand from extractelement was directly used to create a shufflevector mask. Since the index can be of any integral type but the mask must only contain 32 bit integers a 64 bit index operand led to an assertion error later on. Committed on behalf of mpflanzer (Moritz Pflanzer) Differential Revision: http://reviews.llvm.org/D10838 llvm-svn: 243851
* Rangify for loops, NFC.Yaron Keren2015-08-014-9/+8
| | | | llvm-svn: 243841
* [MS ABI] Hook clang up to the new EH instructionsDavid Majnemer2015-07-317-44/+238
| | | | | | | | | | The new EH instructions make it possible for LLVM to generate .xdata tables that the MSVC personality routines will be happy about. Because this is experimental, hide it behind a -cc1 flag (-fnew-ms-eh). Differential Revision: http://reviews.llvm.org/D11405 llvm-svn: 243767
* DI: Update for LLVM API change for local variablesDuncan P. N. Exon Smith2015-07-312-22/+26
| | | | | | | | Adjust to LLVM DIBuilder API changes in r243764, using `createAutoVariable()` and `createParameterVariable()` in place of `createLocalVariable()`. No real functionality change here. llvm-svn: 243765
* Updated test regex and flagsNaomi Musgrave2015-07-301-2/+2
| | | | llvm-svn: 243669
* repress tail call optimization when performing use-after-dtor sanitizationNaomi Musgrave2015-07-301-0/+4
| | | | | | | | | | Reviewers: eugenis, kcc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11613 llvm-svn: 243668
* Use llvm::reverse to make a bunch of loops use foreach. NFC.Pete Cooper2015-07-302-10/+9
| | | | | | | | | | | | | | | | In llvm commit r243581, a reverse range adapter was added which allows us to change code such as for (auto I = Fields.rbegin(), E = Fields.rend(); I != E; ++I) { in to for (const FieldDecl *I : llvm::reverse(Fields)) This commit changes a few of the places in clang which are eligible to use this new adapter. llvm-svn: 243663
* In case of an existing GlobalVariable, the comdat is created using the name ↵Yaron Keren2015-07-291-3/+3
| | | | | | | | | | | | | of the new GV (usually NAME.1) instead of the correct NAME of the old GV. Moving comdat creation after GV replacement solves this. Patch + testcase. Reviewed by Reid Kleckner. http://reviews.llvm.org/D11594 llvm-svn: 243525
* Remove unnecessary variable.Yaron Keren2015-07-291-12/+8
| | | | llvm-svn: 243517
* Add -femulated-tls flag to select the emulated TLS model.Chih-Hung Hsieh2015-07-281-0/+1
| | | | | | | | | This will be used for old targets like Android that do not support ELF TLS models. Differential Revision: http://reviews.llvm.org/D10524 llvm-svn: 243441
* [CodeGen] Simplify creation of shuffle masks.Benjamin Kramer2015-07-282-39/+10
| | | | | | No functional change intended. llvm-svn: 243439
* Getting rid of old iterator loopsPiotr Padlewski2015-07-282-15/+11
| | | | llvm-svn: 243431
* [CodeGen] Clean up CGBuiltin a bit.Benjamin Kramer2015-07-281-272/+176
| | | | | | | | | | - Use cached LLVM types - Turn SmallVectors into Arrays/ArrayRef if the size is static - Use ConstantInt::get's implicit splatting for vector types No functionality change intended. llvm-svn: 243425
* [AArch64] Implement __builtin_thread_pointerAdhemerval Zanella2015-07-281-0/+5
| | | | | | | This path add the aarch64 __builtin_thread_pointer support. It will be lowered to llvm.aarch64.thread.pointer. llvm-svn: 243413
* InstrProf: Fix a misuse of the FunctionDecl API when generating coverageJustin Bogner2015-07-281-1/+1
| | | | | | | | | | | This was calling FD->hasBody(), meaning "Does the function that this decl refers to have a body?", rather than FD->doesThisDeclarationHaveABody(), meaning "Is this decl a non-deleted definition?". We might want to consider renaming these APIs :/ llvm-svn: 243360
* Use CGLoopInfo to emit metadata for loop hint pragmas.Tyler Nowicki2015-07-274-134/+143
| | | | | | | | When ‘#pragma clang loop vectorize(assume_safety)’ was specified on a loop other loop hints were lost. The problem is that CGLoopInfo attaches metadata differently than EmitCondBrHints in CGStmt. For do-loops CGLoopInfo attaches metadata to the br in the body block and for while and for loops, the inc block. EmitCondBrHints on the other hand always attaches data to the br in the cond block. When specifying assume_safety CGLoopInfo emits an empty llvm.loop metadata shadowing the metadata in the cond block. Loop transformations like rotate and unswitch would then eliminate the cond block and its non-empty metadata. This patch unifies both approaches for adding metadata and modifies the existing safety tests to include non-assume_safety loop hints. llvm-svn: 243315
* [OpenMP] Add capture for threadprivate variables used in copyin clauseSamuel Antao2015-07-271-4/+16
| | | | | | if TLS is enabled in OpenMP code generation. llvm-svn: 243277
* [CodeGen] Don't UBSan-ize the argument to __builtin_frame_addressDavid Majnemer2015-07-251-4/+4
| | | | | | | | | | | | | __builtin_frame_address requires its argument to be a constant expression which already implies that it cannot have undefined behavior. However, we used EmitScalarExpr to emit the argument causing UBSan to try to check for overflow. Instead, use the constant expression emission system. This fixes PR24256. llvm-svn: 243206
* DI: Make getOrCreateLimitedType() return DICompositeType, NFCDuncan P. N. Exon Smith2015-07-242-7/+6
| | | | | | | | | Change `getOrCreateLimitedType()` to return a `DICompositeType` and remove the casts from its callers. Inside, I've strengthened a `cast` from `DICompositeTypeBase`, but the casts in the callers already prove that this is safe. There should be no functionality change here. llvm-svn: 243155
* DI: Make StaticDataMemberCache type-safe, NFCDuncan P. N. Exon Smith2015-07-242-3/+4
| | | | | | | Change `StaticDataMemberCache` to store references to `DIDerivedType` directly, and remove now-unnecessary casts from the accessors. llvm-svn: 243129
* LLVM API Change: the Module always owns the DataLayoutMehdi Amini2015-07-248-37/+23
| | | | | From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 243115
* Generating available_externally vtables for outline virtual functionsPiotr Padlewski2015-07-244-12/+70
| | | | | | | | | | | | | | Generating available_externally vtables for optimizations purposes. Unfortunatelly ItaniumABI doesn't guarantee that we will be able to refer to virtual inline method by name. But when we don't have any inline virtual methods, and key function is not defined in this TU, we can generate that there will be vtable and mark it as available_externally. This is patch will help devirtualize better. Differential Revision: http://reviews.llvm.org/D11441 llvm-svn: 243090
* InstrProf: Don't extend coverage regions into the catch keywordJustin Bogner2015-07-231-1/+0
| | | | | | | | The catch keyword isn't really part of a region, so it's fairly meaningless to extend into it. This was usually harmless, but it could crash when catch blocks involved macros in strange ways. llvm-svn: 243066
* Move EHPersonality to CGCleanupDavid Majnemer2015-07-222-32/+33
| | | | | | | | This makes it possible to use EHPersonality in other parts of CodeGen. Differential Revision: http://reviews.llvm.org/D11440 llvm-svn: 242971
* Fix -Wextra-semi warnings.Hans Wennborg2015-07-221-3/+3
| | | | | | | | Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D11401 llvm-svn: 242931
* Fix GCC build due to shadowingDavid Blaikie2015-07-211-2/+2
| | | | llvm-svn: 242826
* Pass an iterator range to EmitCallArgsDavid Blaikie2015-07-218-35/+30
| | | | llvm-svn: 242824
* Commit for http://reviews.llvm.org/D10765Michael Wong2015-07-213-0/+13
| | | | | | | for OpenMP 4 target data directive parsing and sema. This commit is on behalf of Kelvin Li. llvm-svn: 242785
* [MS Compat] Add support for __declspec(noalias)David Majnemer2015-07-201-1/+4
| | | | | | | The attribute '__declspec(noalias)' communicates that the function only accesses memory pointed to by its pointer-typed arguments. llvm-svn: 242728
* Fix a case where we forgot to make a static local variable comdatReid Kleckner2015-07-201-0/+1
| | | | | | | | | | | | | Sometimes we can provide an initializer for static locals, in which case we sometimes might need to change the type. Changing the type requires making a new LLVM GlobalVariable, and in this codepath we were forgetting to transfer the comdat. Fixes PR23838. Patch by Ivan Garramona. llvm-svn: 242704
* Fix quoting of #pragma comment for PS4.Yunzhong Gao2015-07-201-1/+5
| | | | | | | | | | | | This is the PS4 counterpart to r229376, which quotes the library name if the name contains space. It was discovered that if a library name contains both double-quote and space characters, quoting the name might produce unexpected results, but we are mostly concerned with a Windows host environment, which does not allow double-quote or slashes in file/folder names. Differential Revision: http://reviews.llvm.org/D11275 llvm-svn: 242689
* [CodeGen] Flip lanes when lowering __builtin_palignr with one laneBenjamin Kramer2015-07-201-0/+1
| | | | | | | Otherwise we'd pick the wrong lane for the resulting shuffle and miscompile code. PR24187. llvm-svn: 242678
* [CodeGen] Don't dereference vector::end if the vector can be emptyBenjamin Kramer2015-07-181-1/+1
| | | | | | MSVC complains about this in debug mode. NFC. llvm-svn: 242622
* [AST] Cleanup ExprIterator.Benjamin Kramer2015-07-185-10/+8
| | | | | | | | - Make it a proper random access iterator with a little help from iterator_adaptor_base - Clean up users of magic dereferencing. The iterator should behave like an Expr **. - Make it an implementation detail of Stmt. This allows inlining of the assertions. llvm-svn: 242608
* InstrProf: Promote this assert to a report_fatal_errorJustin Bogner2015-07-171-2/+2
| | | | | | | | If this assert does fire, the no-asserts behaviour is an infinite loop. It's better to crash in this case so we get a crash report and stop wasting the user's cpu cycles. llvm-svn: 242591
OpenPOWER on IntegriCloud