summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
Commit message (Collapse)AuthorAgeFilesLines
...
* Be more strict about not calling setAlignment on global aliases.Rafael Espindola2014-05-061-3/+6
| | | | | | | The fact that GlobalAlias::setAlignment exists at all is a side effect of how the classes are organized, it should never be used. llvm-svn: 208094
* PR19598: Provide the ability to RAUW a declaration with itself, creating a ↵David Blaikie2014-05-062-20/+53
| | | | | | | | | | | | | non-temporary copy and using that to RAUW. Also, provide the ability to create temporary and non-temporary declarations, as not all declarations may be replaced by definitions later on. This provides the necessary infrastructure for Clang to fix PR19598, leaking temporary MDNodes in Clang's debug info generation. llvm-svn: 208054
* IR: Cleanup AttributeSet::get for AttrBuilderDavid Majnemer2014-05-031-4/+5
| | | | | | | We don't modify the AttrBuilder in AttributeSet::get, make the reference argument const. llvm-svn: 207924
* Aliases are always definitions. Delete dead code.Rafael Espindola2014-05-021-6/+2
| | | | llvm-svn: 207869
* llvm-cov: Fix handling of line zero appearing in a line tableJustin Bogner2014-05-021-6/+18
| | | | | | | | | | | | | Reading line tables in llvm-cov was pretty broken, but would happen to work as long as no line in the table was 0. It's not clear to me whether a line of zero *should* show up in these tables, but deciding to read a string in the middle of the line table is certainly the wrong thing to do if it does. I've also added some comments, as trying to figure out what this block of code was doing was fairly unpleasant. llvm-svn: 207866
* [IR] Make {extract,insert}element accept an index of any integer type.Michael J. Spencer2014-05-012-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given the following C code llvm currently generates suboptimal code for x86-64: __m128 bss4( const __m128 *ptr, size_t i, size_t j ) { float f = ptr[i][j]; return (__m128) { f, f, f, f }; } ================================================= define <4 x float> @_Z4bss4PKDv4_fmm(<4 x float>* nocapture readonly %ptr, i64 %i, i64 %j) #0 { %a1 = getelementptr inbounds <4 x float>* %ptr, i64 %i %a2 = load <4 x float>* %a1, align 16, !tbaa !1 %a3 = trunc i64 %j to i32 %a4 = extractelement <4 x float> %a2, i32 %a3 %a5 = insertelement <4 x float> undef, float %a4, i32 0 %a6 = insertelement <4 x float> %a5, float %a4, i32 1 %a7 = insertelement <4 x float> %a6, float %a4, i32 2 %a8 = insertelement <4 x float> %a7, float %a4, i32 3 ret <4 x float> %a8 } ================================================= shlq $4, %rsi addq %rdi, %rsi movslq %edx, %rax vbroadcastss (%rsi,%rax,4), %xmm0 retq ================================================= The movslq is uneeded, but is present because of the trunc to i32 and then sext back to i64 that the backend adds for vbroadcastss. We can't remove it because it changes the meaning. The IR that clang generates is already suboptimal. What clang really should emit is: %a4 = extractelement <4 x float> %a2, i64 %j This patch makes that legal. A separate patch will teach clang to do it. Differential Revision: http://reviews.llvm.org/D3519 llvm-svn: 207801
* PR19623: Implement typedefs of void.David Blaikie2014-05-011-1/+0
| | | | | | | | This the LLVM portion that will allow Clang and other frontends to emit typedefs of void by providing a null type for the typedef's underlying type. llvm-svn: 207777
* IR: Conservatively verify inalloca argumentsDavid Majnemer2014-04-301-0/+10
| | | | | | | | | | | | Summary: Try to spot obvious mismatches with inalloca use. Reviewers: rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D3572 llvm-svn: 207676
* IR: Alloca clones should remember inalloca stateDavid Majnemer2014-04-301-3/+4
| | | | | | | | | Pretty straightforward, we weren't propagating whether or not an AllocaInst had 'inalloca' marked on it when it came time to clone it. The inliner exposed this bug. A reduced testcase is forthcoming. llvm-svn: 207665
* Try to fix the msvc build.Benjamin Kramer2014-04-291-0/+1
| | | | llvm-svn: 207594
* raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer2014-04-291-0/+1
| | | | | | necessary. llvm-svn: 207593
* [PM] Add pass run listeners to the pass manager.Juergen Ributzka2014-04-286-1/+111
| | | | | | | | | | | | | | | | | | This commit provides the necessary C/C++ APIs and infastructure to enable fine- grain progress report and safe suspension points after each pass in the pass manager. Clients can provide a callback function to the pass manager to call after each pass. This can be used in a variety of ways (progress report, dumping of IR between passes, safe suspension of threads, etc). The run listener list is maintained in the LLVMContext, which allows a multi- threaded client to be only informed for it's own thread. This of course assumes that the client created a LLVMContext for each thread. This fixes <rdar://problem/16728690> llvm-svn: 207430
* Modify the assertion in DIBuilder.cpp to cover the DWARF 5 languagesPeter Collingbourne2014-04-281-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D3523 llvm-svn: 207428
* [C++] Use 'nullptr'.Craig Topper2014-04-284-11/+11
| | | | llvm-svn: 207394
* Teach the pass manager's execution dump to print the current time beforeChandler Carruth2014-04-271-1/+3
| | | | | | | | | | | | | | | each line. This is particularly nice for tracking which run of a particular pass over a particular function was slow. This also required making the TimeValue string much more useful. First, there is a standard format for writing out a date and time. Let's use that rather than strings that would have to be parsed. Second, actually output the nanosecond resolution that timevalue claims to have. This is proving useful working on PR19499, so I figured it would be generally useful to commit. llvm-svn: 207385
* Add missing include guards and missing #include, found by modules build.Richard Smith2014-04-261-0/+6
| | | | llvm-svn: 207298
* Add 'musttail' marker to call instructionsReid Kleckner2014-04-242-2/+95
| | | | | | | | | | | | This is similar to the 'tail' marker, except that it guarantees that tail call optimization will occur. It also comes with convervative IR verification rules that ensure that tail call optimization is possible. Reviewers: nicholas Differential Revision: http://llvm-reviews.chandlerc.com/D3240 llvm-svn: 207143
* llvm-cov: Add support for gcov's --long-file-names optionJustin Bogner2014-04-231-5/+9
| | | | | | | | GCOV provides an option to prepend output file names with the source file name, to disambiguate between covered data that's included from multiple sources. Add a flag to llvm-cov that does the same. llvm-svn: 207035
* Use pointer size function where only a pointer is expectedMatt Arsenault2014-04-231-1/+1
| | | | llvm-svn: 207023
* Remove more default address space argument usage.Matt Arsenault2014-04-231-1/+1
| | | | | | These places are inconsequential in practice. llvm-svn: 207021
* Remove AssemblyAnnotationWriter from NamedMDNode::print.Rafael Espindola2014-04-231-3/+3
| | | | | | | | No functionality change, this parameter was always set to nullptr. Patch by Robert Matusewicz! llvm-svn: 206972
* Fix DataLayout::operator==().Rafael Espindola2014-04-221-1/+1
| | | | | | Patch by Maks Naumov! llvm-svn: 206911
* [Modules] Remove potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-221-1/+2
| | | | | | | | | | | | define below all header includes in the lib/CodeGen/... tree. While the current modules implementation doesn't check for this kind of ODR violation yet, it is likely to grow support for it in the future. It also removes one layer of macro pollution across all the included headers. Other sub-trees will follow. llvm-svn: 206837
* [Modules] Make Support/Debug.h modular. This requires it to not changeChandler Carruth2014-04-213-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | behavior based on other files defining DEBUG_TYPE, which means it cannot define DEBUG_TYPE at all. This is actually better IMO as it forces folks to define relevant DEBUG_TYPEs for their files. However, it requires all files that currently use DEBUG(...) to define a DEBUG_TYPE if they don't already. I've updated all such files in LLVM and will do the same for other upstream projects. This still leaves one important change in how LLVM uses the DEBUG_TYPE macro going forward: we need to only define the macro *after* header files have been #include-ed. Previously, this wasn't possible because Debug.h required the macro to be pre-defined. This commit removes that. By defining DEBUG_TYPE after the includes two things are fixed: - Header files that need to provide a DEBUG_TYPE for some inline code can do so by defining the macro before their inline code and undef-ing it afterward so the macro does not escape. - We no longer have rampant ODR violations due to including headers with different DEBUG_TYPE definitions. This may be mostly an academic violation today, but with modules these types of violations are easy to check for and potentially very relevant. Where necessary to suppor headers with DEBUG_TYPE, I have moved the definitions below the includes in this commit. I plan to move the rest of the DEBUG_TYPE macros in LLVM in subsequent commits; this one is big enough. The comments in Debug.h, which were hilariously out of date already, have been updated to reflect the recommended practice going forward. llvm-svn: 206822
* Use unique_ptr to manage ownership of GCOVFunctions, Blocks, and Edges.David Blaikie2014-04-211-36/+21
| | | | llvm-svn: 206796
* Simplify destruction of Modules in LLVContextImpl.David Blaikie2014-04-211-6/+5
| | | | | | | | | | | | | | | | | | | | This avoids copying the container by simply deleting until empty. While I'd rather move to a stricter ownership semantic (unique_ptr), SmallPtrSet can't cope with unique_ptr and the ownership semantics here are a bit incestuous (Module sort of owns itself, but sort of doesn't (if the LLVMContext is destroyed before the Module, then it deregisters itself from the context... )). Ideally Modules would be given to the context, or possibly an emplace-like function to construct them there. Modules then shouldn't be destroyed by LLVM API clients, but by interacting with the owner (LLVMContext) directly (but even then, passing a Module* to LLVMContext doesn't provide an easy way to destroy the Module, since the set would be over unique_ptrs and you'd need a heterogenous lookup function which SmallPtrSet doesn't have either). llvm-svn: 206794
* [PM] Fix a bug where we didn't properly clear the list map when the listChandler Carruth2014-04-211-0/+2
| | | | | | | | | | became empty. This would manifest later as an assert failure due to a non-empty list map but an empty result map. This doesn't easily manifest with just the module pass manager and the function pass manager, but the next commit will add the CGSCC pass manager that hits this assert immediately. llvm-svn: 206744
* Fix bug 19437 - Only add discriminators for DWARF 4 and above.Diego Novillo2014-04-171-0/+8
| | | | | | | | | | | | | | Summary: This prevents the discriminator generation pass from triggering if the DWARF version being used in the module is prior to 4. Reviewers: echristo, dblaikie CC: llvm-commits Differential Revision: http://reviews.llvm.org/D3413 llvm-svn: 206507
* Added new functionality to LLVM C API to use DiagnosticInfo to handle errorsTom Stellard2014-04-161-0/+44
| | | | | | Patch by: Darren Powell llvm-svn: 206407
* Allow diagnostic handlers to check for optimization remarks.Diego Novillo2014-04-161-2/+11
| | | | | | | | | | | | | | | | | | Summary: When optimization remarks are enabled via the driver flag -Rpass, we should allow the FE diagnostic handler to check if the given pass name needs a diagnostic. We were unconditionally checking the pattern defined in opt's -pass-remarks flag. This was causing the FE to not emit any diagnostics. Reviewers: qcolombet CC: llvm-commits Differential Revision: http://reviews.llvm.org/D3362 llvm-svn: 206400
* verify-di: Add back braces for MSVC compatabilityDuncan P. N. Exon Smith2014-04-151-5/+12
| | | | | | | | Fixup after r206300. <rdar://problem/15500563> llvm-svn: 206305
* verify-di: Implement DebugInfoVerifierDuncan P. N. Exon Smith2014-04-151-49/+92
| | | | | | | | | | | | | | | | | | | | | Implement DebugInfoVerifier, which steals verification relying on DebugInfoFinder from Verifier. - Adds LegacyDebugInfoVerifierPassPass, a ModulePass which wraps DebugInfoVerifier. Uses -verify-di command-line flag. - Change verifyModule() to invoke DebugInfoVerifier as well as Verifier. - Add a call to createDebugInfoVerifierPass() wherever there was a call to createVerifierPass(). This implementation as a module pass should sidestep efficiency issues, allowing us to turn debug info verification back on. <rdar://problem/15500563> llvm-svn: 206300
* verify-di: split out VerifierSupportDuncan P. N. Exon Smith2014-04-151-57/+62
| | | | | | | | | Split out assertion and output helpers from Verifier in preparation for writing the DebugInfoVerifier. <rdar://problem/15500563> llvm-svn: 206299
* Use unique_ptr to manage PassInfo instances in the PassRegistryDavid Blaikie2014-04-151-8/+4
| | | | llvm-svn: 206297
* Break PseudoSourceValue out of the Value hierarchy. It is now the root of ↵Nick Lewycky2014-04-151-6/+0
| | | | | | its own tree containing FixedStackPseudoSourceValue (which you can use isa/dyn_cast on) and MipsCallEntry (which you can't). Anything that needs to use either a PseudoSourceValue* and Value* is strongly encouraged to use a MachinePointerInfo instead. llvm-svn: 206255
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-1511-22/+23
| | | | | | instead of comparing to nullptr. llvm-svn: 206252
* Retire llvm::array_endof in favor of non-member std::end.Benjamin Kramer2014-04-121-0/+1
| | | | | | While there make array_lengthof constexpr if we have support for it. llvm-svn: 206112
* Move MDBuilder's methods out of line.Benjamin Kramer2014-04-122-2/+142
| | | | | | | Making them inline was a historical accident, they're neither hot nor templated. llvm-svn: 206109
* Fix use-after-free bug caught by address sanitizer:Diego Novillo2014-04-111-1/+1
| | | | | | | | http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/2959 The location string is returned as a std::string, not a StringRef. llvm-svn: 206032
* Fix some doc and comment typosAlp Toker2014-04-091-1/+1
| | | | llvm-svn: 205899
* [C++11] More 'nullptr' conversion or in some cases just using a boolean ↵Craig Topper2014-04-0932-402/+414
| | | | | | check instead of comparing to nullptr. llvm-svn: 205831
* Verifier: Give the right message for bad atomic loadsDuncan P. N. Exon Smith2014-04-081-2/+2
| | | | | | | | Talk about load (not store) on an invalid atomic load. <rdar://problem/16287567> llvm-svn: 205777
* Add -pass-remarks flag to 'opt'.Diego Novillo2014-04-083-1/+61
| | | | | | | | | | | | | | | | | | | | | Summary: This adds support in 'opt' to filter pass remarks emitted by optimization passes. A new flag -pass-remarks specifies which passes should emit a diagnostic when LLVMContext::emitOptimizationRemark is invoked. This will allow the front end to simply pass along the regular expression from its own -Rpass flag when launching the backend. Depends on D3227. Reviewers: qcolombet CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3291 llvm-svn: 205775
* Add support for optimization reports.Diego Novillo2014-04-082-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds backend support for -Rpass=, which indicates the name of the optimization pass that should emit remarks stating when it made a transformation to the code. Pass names are taken from their DEBUG_NAME definitions. When emitting an optimization report diagnostic, the lack of debug information causes the diagnostic to use "<unknown>:0:0" as the location string. This is the back end counterpart for http://llvm-reviews.chandlerc.com/D3226 Reviewers: qcolombet CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3227 llvm-svn: 205774
* Fix a (legacy) PassManager crash that occurs when a ModulePassAndrew Trick2014-04-081-6/+18
| | | | | | | | | indirectly requires a function analysis. This bug was reported by Jason Kim. He included a test case here: http://reviews.llvm.org/D3312 llvm-svn: 205753
* Invert the option to enable debug info verification. No functionalEric Christopher2014-04-071-8/+7
| | | | | | change outside of the command line to enable it. llvm-svn: 205713
* DebugInfo: Support namespace aliases as DW_TAG_imported_declaration instead ↵David Blaikie2014-04-061-24/+23
| | | | | | | | | | | | | | | | of DW_TAG_imported_module I really should read the spec more often (and test GCC more often too). I just assumed that namespace aliases would be the same as using directives, except with a name. But apparently that's not how the DWARF standards suggests they be implemented. DWARF4 provides an example and other non-normative text suggesting that namespace aliases be implemented by named imported declarations intsead of named imported modules. So be it. llvm-svn: 205685
* Remove unused parameterDavid Blaikie2014-04-051-8/+8
| | | | | | | | | | | Also update a few null pointers in this function to be consistent with new null pointers being added. Patch by Robert Matusewicz! Differential Revision: http://reviews.llvm.org/D3123 llvm-svn: 205682
* ARM: update subtarget information for Windows on ARMSaleem Abdulrasool2014-04-021-4/+3
| | | | | | | Update the subtarget information for Windows on ARM. This enables using the MC layer to target Windows on ARM. llvm-svn: 205459
* Add a comment about the DIDescriptor class hierarchy.Adrian Prantl2014-04-011-2/+4
| | | | llvm-svn: 205358
OpenPOWER on IntegriCloud