summaryrefslogtreecommitdiff
path: root/lib/IR/Verifier.cpp
Commit message (Collapse)AuthorAge
* Verifier: Update assert message to reflect LangRefDavid Majnemer2014-06-28
| | | | | | No functionality change, just correcting the assertion message. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211977 91177308-0d34-0410-b5e6-96231b3b80d8
* IR: Add COMDATs to the IRDavid Majnemer2014-06-27
| | | | | | | | | | | | | | | | This new IR facility allows us to represent the object-file semantic of a COMDAT group. COMDATs allow us to tie together sections and make the inclusion of one dependent on another. This is required to implement features like MS ABI VFTables and optimizing away certain kinds of initialization in C++. This functionality is only representable in COFF and ELF, Mach-O has no similar mechanism. Differential Revision: http://reviews.llvm.org/D4178 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211920 91177308-0d34-0410-b5e6-96231b3b80d8
* [ValueTracking] Extend range metadata to call/invokeJingyue Wu2014-06-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With this patch, range metadata can be added to call/invoke including IntrinsicInst. Previously, it could only be added to load. Rename computeKnownBitsLoad to computeKnownBitsFromRangeMetadata because range metadata is not only used by load. Update the language reference to reflect this change. Test Plan: Add several tests in range-2.ll to confirm the verifier is happy with having range metadata on call/invoke. Add two tests in AddOverFlow.ll to confirm annotating range metadata to call/invoke can benefit InstCombine. Reviewers: meheff, nlewycky, reames, hfinkel, eliben Reviewed By: eliben Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D4187 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211281 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix verifier for GlobalAliases to avoid recursing into global initializers.Bob Wilson2014-06-12
| | | | | | | | | | | The verifier follows GlobalAlias operands so that it can detect cycles of alias definitions. It was doing this in a way that caused it to also recurse through initializers for the GlobalValue aliasees, and it would fail when an initializer refers to a global that is a declaration and not a definition. This patch causes it to stop recursing when it hits a global definition. <rdar://problem/17277451> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210734 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow aliases to be unnamed_addr.Rafael Espindola2014-06-06
| | | | | | | | | | | | | | | | | | Alias with unnamed_addr were in a strange state. It is stored in GlobalValue, the language reference talks about "unnamed_addr aliases" but the verifier was rejecting them. It seems natural to allow unnamed_addr in aliases: * It is a property of how it is accessed, not of the data itself. * It is perfectly possible to write code that depends on the address of an alias. This patch then makes unname_addr legal for aliases. One side effect is that the syntax changes for a corner case: In globals, unnamed_addr is now printed before the address space. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210302 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new attribute called 'jumptable' that creates jump-instruction tables ↵Tom Roeder2014-06-05
| | | | | | | | | | | | | for functions marked with this attribute. It includes a pass that rewrites all indirect calls to jumptable functions to pass through these tables. This also adds backend support for generating the jump-instruction tables on ARM and X86. Note that since the jumptable attribute creates a second function pointer for a function, any function marked with jumptable must also be marked with unnamed_addr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210280 91177308-0d34-0410-b5e6-96231b3b80d8
* Clauses in a landingpad are always Constant. Use a stricter type.Rafael Espindola2014-06-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210203 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow alias to point to an arbitrary ConstantExpr.Rafael Espindola2014-06-03
| | | | | | | | | | | | | | | | | | | | | This patch changes GlobalAlias to point to an arbitrary ConstantExpr and it is up to MC (or the system assembler) to decide if that expression is valid or not. This reduces our ability to diagnose invalid uses and how early we can spot them, but it also lets us do things like @test5 = alias inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32), i32 ptrtoint (i32* @bar to i32)) to i32*) An important implication of this patch is that the notion of aliased global doesn't exist any more. The alias has to encode the information needed to access it in its metadata (linkage, visibility, type, etc). Another consequence to notice is that getSection has to return a "const char *". It could return a NullTerminatedStringRef if there was such a thing, but when that was proposed the decision was to just uses "const char*" for that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210062 91177308-0d34-0410-b5e6-96231b3b80d8
* Use existing helper function.Rafael Espindola2014-05-26
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209639 91177308-0d34-0410-b5e6-96231b3b80d8
* Add comdat key field to llvm.global_ctors and llvm.global_dtorsReid Kleckner2014-05-16
| | | | | | | | | | | | | | This allows us to put dynamic initializers for weak data into the same comdat group as the data being initialized. This is necessary for MSVC ABI compatibility. Once we have comdats for guard variables, we can use the combination to help GlobalOpt fire more often for weak data with guarded initialization on other platforms. Reviewers: nlewycky Differential Revision: http://reviews.llvm.org/D3499 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209015 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix most of PR10367.Rafael Espindola2014-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the design of GlobalAlias so that it doesn't take a ConstantExpr anymore. It now points directly to a GlobalObject, but its type is independent of the aliasee type. To avoid changing all alias related tests in this patches, I kept the common syntax @foo = alias i32* @bar to mean the same as now. The cases that used to use cast now use the more general syntax @foo = alias i16, i32* @bar. Note that GlobalAlias now behaves a bit more like GlobalVariable. We know that its type is always a pointer, so we omit the '*'. For the bitcode, a nice surprise is that we were writing both identical types already, so the format change is minimal. Auto upgrade is handled by looking through the casts and no new fields are needed for now. New bitcode will simply have different types for Alias and Aliasee. One last interesting point in the patch is that replaceAllUsesWith becomes smart enough to avoid putting a ConstantExpr in the aliasee. This seems better than checking and updating every caller. A followup patch will delete getAliasedGlobal now that it is redundant. Another patch will add support for an explicit offset. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209007 91177308-0d34-0410-b5e6-96231b3b80d8
* musttail: Fix the verification of alignment attributesReid Kleckner2014-05-15
| | | | | | | Previously this would fail with an assertion failure when trying to add an alignment attribute without a value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208935 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow sret on the second parameter as well as the firstReid Kleckner2014-05-09
| | | | | | | | | | | | | | | | | | | | | | | | | MSVC always places the implicit sret parameter after the implicit this parameter of instance methods. We used to handle this for x86_thiscallcc by allocating the sret parameter on the stack and leaving the this pointer in ecx, but that doesn't handle alternative calling conventions like cdecl, stdcall, fastcall, or the win64 convention. Instead, change the verifier to allow sret on the second parameter. This also requires changing the Mips and X86 backends to return the argument with the sret parameter, instead of assuming that the sret parameter comes first. The Sparc backend also returns sret parameters in a register, but I wasn't able to update it to handle secondary sret parameters. It currently calls report_fatal_error if you feed it an sret in the second parameter. Reviewers: rafael.espindola, majnemer Differential Revision: http://reviews.llvm.org/D3617 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208453 91177308-0d34-0410-b5e6-96231b3b80d8
* Special case aliases in GlobalValue::getSection.Rafael Espindola2014-05-06
| | | | | | | | This is similar to the getAlignment patch, but is done just for completeness. It looks like we never call getSection on an alias. All the tests still pass if the if is replaced with an assert. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208139 91177308-0d34-0410-b5e6-96231b3b80d8
* Special case aliases in GlobalValue::getAlignment.Rafael Espindola2014-05-06
| | | | | | | | | An alias has the address of what it points to, so it also has the same alignment. This allows a few optimizations to see past aliases for free. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208103 91177308-0d34-0410-b5e6-96231b3b80d8
* Aliases are always definitions. Delete dead code.Rafael Espindola2014-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207869 91177308-0d34-0410-b5e6-96231b3b80d8
* IR: Conservatively verify inalloca argumentsDavid Majnemer2014-04-30
| | | | | | | | | | | | Summary: Try to spot obvious mismatches with inalloca use. Reviewers: rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D3572 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207676 91177308-0d34-0410-b5e6-96231b3b80d8
* Add 'musttail' marker to call instructionsReid Kleckner2014-04-24
| | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207143 91177308-0d34-0410-b5e6-96231b3b80d8
* verify-di: Add back braces for MSVC compatabilityDuncan P. N. Exon Smith2014-04-15
| | | | | | | | Fixup after r206300. <rdar://problem/15500563> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206305 91177308-0d34-0410-b5e6-96231b3b80d8
* verify-di: Implement DebugInfoVerifierDuncan P. N. Exon Smith2014-04-15
| | | | | | | | | | | | | | | | | | | | | 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> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206300 91177308-0d34-0410-b5e6-96231b3b80d8
* verify-di: split out VerifierSupportDuncan P. N. Exon Smith2014-04-15
| | | | | | | | | Split out assertion and output helpers from Verifier in preparation for writing the DebugInfoVerifier. <rdar://problem/15500563> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206299 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] More 'nullptr' conversion or in some cases just using a boolean ↵Craig Topper2014-04-09
| | | | | | check instead of comparing to nullptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205831 91177308-0d34-0410-b5e6-96231b3b80d8
* Verifier: Give the right message for bad atomic loadsDuncan P. N. Exon Smith2014-04-08
| | | | | | | | Talk about load (not store) on an invalid atomic load. <rdar://problem/16287567> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205777 91177308-0d34-0410-b5e6-96231b3b80d8
* Invert the option to enable debug info verification. No functionalEric Christopher2014-04-07
| | | | | | change outside of the command line to enable it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205713 91177308-0d34-0410-b5e6-96231b3b80d8
* Intrinsics: add LLVMHalfElementsVectorType constraintTim Northover2014-03-29
| | | | | | | | | | This is like the LLVMMatchType, except the verifier checks that the second argument is a vector with the same base type and half the number of elements. This will be used by the ARM64 backend. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205079 91177308-0d34-0410-b5e6-96231b3b80d8
* Intrinsics: expand semantics of LLVMExtendedVectorType (& trunc)Tim Northover2014-03-28
| | | | | | | | | | | | These are used in the ARM backends to aid type-checking on patterns involving intrinsics. By making sure one argument is an extended/truncated version of another. However, there's no reason to limit them to just vectors types. For example AArch64 has the instruction "uqshrn sD, dN, #imm" which would naturally use an intrinsic taking an i64 and returning an i32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205003 91177308-0d34-0410-b5e6-96231b3b80d8
* Prevent alias from pointing to weak aliases.Rafael Espindola2014-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds back r204781. Original message: Aliases are just another name for a position in a file. As such, the regular symbol resolutions are not applied. For example, given define void @my_func() { ret void } @my_alias = alias weak void ()* @my_func @my_alias2 = alias void ()* @my_alias We produce without this patch: .weak my_alias my_alias = my_func .globl my_alias2 my_alias2 = my_alias That is, in the resulting ELF file my_alias, my_func and my_alias are just 3 names pointing to offset 0 of .text. That is *not* the semantics of IR linking. For example, linking in a @my_alias = alias void ()* @other_func would require the strong my_alias to override the weak one and my_alias2 would end up pointing to other_func. There is no way to represent that with aliases being just another name, so the best solution seems to be to just disallow it, converting a miscompile into an error. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204934 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Prevent alias from pointing to weak aliases."Rafael Espindola2014-03-26
| | | | | | | | | This reverts commit r204781. I will follow up to with msan folks to see what is what they were trying to do with aliases to weak aliases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204784 91177308-0d34-0410-b5e6-96231b3b80d8
* Prevent alias from pointing to weak aliases.Rafael Espindola2014-03-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Aliases are just another name for a position in a file. As such, the regular symbol resolutions are not applied. For example, given define void @my_func() { ret void } @my_alias = alias weak void ()* @my_func @my_alias2 = alias void ()* @my_alias We produce without this patch: .weak my_alias my_alias = my_func .globl my_alias2 my_alias2 = my_alias That is, in the resulting ELF file my_alias, my_func and my_alias are just 3 names pointing to offset 0 of .text. That is *not* the semantics of IR linking. For example, linking in a @my_alias = alias void ()* @other_func would require the strong my_alias to override the weak one and my_alias2 would end up pointing to other_func. There is no way to represent that with aliases being just another name, so the best solution seems to be to just disallow it, converting a miscompile into an error. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204781 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Change DebugInfoFinder to use range-based loopsAlon Mishne2014-03-18
| | | | | | Also changes the iterators to return actual DI type over MDNode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204130 91177308-0d34-0410-b5e6-96231b3b80d8
* Reject alias to undefined symbols in the verifier.Rafael Espindola2014-03-12
| | | | | | | | | | | | | | | On ELF and COFF an alias is just another name for a position in the file. There is no way to refer to a position in another file, so an alias to undefined is meaningless. MachO currently doesn't support aliases. The spec has a N_INDR, which when implemented will have a different set of restrictions. Adding support for it shouldn't be harder than any other IR extension. For now, having the IR represent what is actually possible with current tools makes it easier to fix the design of GlobalAlias. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203705 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid repeated calls to CE->getOperand(0). No functionality change.Rafael Espindola2014-03-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203686 91177308-0d34-0410-b5e6-96231b3b80d8
* IR: add a second ordering operand to cmpxhg for failureTim Northover2014-03-11
| | | | | | | | | | | | | | | The syntax for "cmpxchg" should now look something like: cmpxchg i32* %addr, i32 42, i32 3 acquire monotonic where the second ordering argument gives the required semantics in the case that no exchange takes place. It should be no stronger than the first ordering constraint and cannot be either "release" or "acq_rel" (since no store will have taken place). rdar://problem/15996804 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203559 91177308-0d34-0410-b5e6-96231b3b80d8
* IR: Slightly more verbose error in VerifierJustin Bogner2014-03-10
| | | | | | | | | | Extend the error message generated by the Verifier when an intrinsic name does not match the expected mangling to include the expected name. Simplifies debugging. Patch by Philip Reames! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203490 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Fix break due to MSVC bug.Ahmed Charles2014-03-09
| | | | | | | | | | | | | | | MSVC (2012, 2013, 2013 Nov CTP) fail on the following code: int main() { int arr[] = {1, 2}; for (int i : arr) do {} while (0); } The fix is to put {} around the for loop. I've reported this to the MSVC team. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203371 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add range based accessors for the Use-Def chain of a Value.Chandler Carruth2014-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires a number of steps. 1) Move value_use_iterator into the Value class as an implementation detail 2) Change it to actually be a *Use* iterator rather than a *User* iterator. 3) Add an adaptor which is a User iterator that always looks through the Use to the User. 4) Wrap these in Value::use_iterator and Value::user_iterator typedefs. 5) Add the range adaptors as Value::uses() and Value::users(). 6) Update *all* of the callers to correctly distinguish between whether they wanted a use_iterator (and to explicitly dig out the User when needed), or a user_iterator which makes the Use itself totally opaque. Because #6 requires churning essentially everything that walked the Use-Def chains, I went ahead and added all of the range adaptors and switched them to range-based loops where appropriate. Also because the renaming requires at least churning every line of code, it didn't make any sense to split these up into multiple commits -- all of which would touch all of the same lies of code. The result is still not quite optimal. The Value::use_iterator is a nice regular iterator, but Value::user_iterator is an iterator over User*s rather than over the User objects themselves. As a consequence, it fits a bit awkwardly into the range-based world and it has the weird extra-dereferencing 'operator->' that so many of our iterators have. I think this could be fixed by providing something which transforms a range of T&s into a range of T*s, but that *can* be separated into another patch, and it isn't yet 100% clear whether this is the right move. However, this change gets us most of the benefit and cleans up a substantial amount of code around Use and User. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203364 91177308-0d34-0410-b5e6-96231b3b80d8
* [Layering] Move InstVisitor.h into the IR library as it is prettyChandler Carruth2014-03-06
| | | | | | obviously coupled to the IR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203064 91177308-0d34-0410-b5e6-96231b3b80d8
* [Layering] Move DebugInfo.h into the IR library where its implementationChandler Carruth2014-03-06
| | | | | | already lives. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203046 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to IR library.Craig Topper2014-03-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202939 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Move the ConstantRange class into the IR library. This isChandler Carruth2014-03-04
| | | | | | | | | | a bit surprising, as the class is almost entirely abstracted away from any particular IR, however it encodes the comparsion predicates which mutate ranges as ICmp predicate codes. This is reasonable as they're used for both instructions and constants. Thus, it belongs in the IR library with instructions and constants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202838 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Move CFG.h to the IR library as it defines graph traits overChandler Carruth2014-03-04
| | | | | | IR types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202827 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Move CallSite into the IR library where it belogs. It isChandler Carruth2014-03-04
| | | | | | | abstracting between a CallInst and an InvokeInst, both of which are IR concepts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202816 91177308-0d34-0410-b5e6-96231b3b80d8
* Check that GlobalAliases don't have section or alignment.Rafael Espindola2014-02-13
| | | | | | | An alias is always in the section of its aliasee and has the same alignment (since it has the same address). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201354 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Wire up the Verifier for the new pass manager and connect it to theChandler Carruth2014-01-20
| | | | | | | | | | | | | | | | | | | | | | various opt verifier commandline options. Mostly mechanical wiring of the verifier to the new pass manager. Exercises one of the more unusual aspects of it -- a pass can be either a module or function pass interchangably. If this is ever problematic, we can make things more constrained, but for things like the verifier where there is an "obvious" applicability at both levels, it seems convenient. This is the next-to-last piece of basic functionality left to make the opt commandline driving of the new pass manager minimally functional for testing and further development. There is still a lot to be done there (notably the factoring into .def files to kill the current boilerplate code) but it is relatively uninteresting. The only interesting bit left for minimal functionality is supporting the registration of analyses. I'm planning on doing that on top of the .def file switch mostly because the boilerplate for the analyses would be significantly worse. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199646 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Make the verifier work independently of any pass manager.Chandler Carruth2014-01-19
| | | | | | | | | | | | | | | | | | | | | | | This makes the 'verifyFunction' and 'verifyModule' functions totally independent operations on the LLVM IR. It also cleans up their API a bit by lifting the abort behavior into their clients and just using an optional raw_ostream parameter to control printing. The implementation of the verifier is now just an InstVisitor with no multiple inheritance. It also is significantly more const-correct, and hides the const violations internally. The two layers that force us to break const correctness are building a DomTree and dispatching through the InstVisitor. A new VerifierPass is used to implement the legacy pass manager interface in terms of the other pieces. The error messages produced may be slightly different now, and we may have slightly different short circuiting behavior with different usage models of the verifier, but generally everything works equivalently and this unblocks wiring the verifier up to the new pass manager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199569 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] [cleanup] Rename some of the Verifier's members, re-arrange them,Chandler Carruth2014-01-17
| | | | | | | | | | | and tweak comments prior to more invasive surgery. Also clean up some other non-doxygen comments, and run clang-format over the parts that are going to change dramatically in subsequent commits so that those don't get cluttered with formatting changes. No functionality changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199489 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Remove the preverifier and directly compute the DominatorTree forChandler Carruth2014-01-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the verifier after ensuring the CFG is at least usefully formed. This fixes a number of problems: 1) The PreVerifier was missing the controls the Verifier provides over *how* an invalid module is handled -- it just aborted the program! Now it uses the same logic as the Verifier which is significantly more library-friendly. 2) The DominatorTree used previously could have been cached and not updated due to bugs in prior passes and we would silently use the stale tree. This could cause dominance errors to not be as quickly diagnosed. 3) We can now (in the next patch) pull the functionality of the verifier apart from the pass infrastructure so that you can verify IR without having any form of pass manager. This in turn frees the code to share logic between old and new pass manager variants. Along the way I fixed at least one annoying bug -- the state for 'Broken' wasn't being cleared from run to run causing all functions visited after the first broken function to be marked as broken regardless of whether *they* were a problem. Fortunately, I don't really know much of a way to observe this peculiarity. In case folks are worried about the runtime cost, its negligible. I looked at running the entire regression test suite (which should be a relatively good use of the verifier) before and after but was unable to even measure the time spent on the verifier and there was no regresion from before to after. I checked both with debug builds and optimized builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199487 91177308-0d34-0410-b5e6-96231b3b80d8
* Change inalloca rules to make it only apply to the last parameterReid Kleckner2014-01-16
| | | | | | | | | | | This makes things a lot easier, because we can now talk about the "argument allocation", which allocates all the memory for the call in one shot. The only functional change is to the verifier for a feature that hasn't shipped yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199434 91177308-0d34-0410-b5e6-96231b3b80d8
* Decouple dllexport/dllimport from linkageNico Rieck2014-01-14
| | | | | | | | | | | | | | | | | | | Representing dllexport/dllimport as distinct linkage types prevents using these attributes on templates and inline functions. Instead of introducing further mixed linkage types to include linkonce and weak ODR, the old import/export linkage types are replaced with a new separate visibility-like specifier: define available_externally dllimport void @f() {} @Var = dllexport global i32 1, align 4 Linkage for dllexported globals and functions is now equal to their linkage without dllexport. Imported globals and functions must be either declarations with external linkage, or definitions with AvailableExternallyLinkage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199218 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Decouple dllexport/dllimport from linkage"Nico Rieck2014-01-14
| | | | | | | | Revert this for now until I fix an issue in Clang with it. This reverts commit r199204. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199207 91177308-0d34-0410-b5e6-96231b3b80d8