summaryrefslogtreecommitdiff
path: root/lib/VMCore/Instruction.cpp
Commit message (Collapse)AuthorAge
* Instruction::isAssociative() returns true for fmul/fadd if they are tagged ↵Shuxin Yang2012-11-29
| | | | | | | | | "unsafe" mode. Approved by: Eli and Michael. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168848 91177308-0d34-0410-b5e6-96231b3b80d8
* Fast-math interfaces for InstructionsMichael Ilseman2012-11-27
| | | | | | | | Add in getter/setter methods for Instructions, allowing them to be the interface to FPMathOperator similarly to now NUS/NSW is handled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168642 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing whitespaceMichael Ilseman2012-11-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168103 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor operation equivalence checking in BBVectorize by extending ↵Hal Finkel2012-06-28
| | | | | | | | | | | Instruction::isSameOperationAs. Maintaining this kind of checking in different places is dangerous, extending Instruction::isSameOperationAs consolidates this logic into one place. Here I've added an optional flags parameter and two flags that are important for vectorization: CompareIgnoringAlignment and CompareUsingScalarTypes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159329 91177308-0d34-0410-b5e6-96231b3b80d8
* Now that Reassociate's LinearizeExprTree can look through arbitrary expressionDuncan Sands2012-06-12
| | | | | | | | | | | | | | | | | | topologies, it is quite possible for a leaf node to have huge multiplicity, for example: x0 = x*x, x1 = x0*x0, x2 = x1*x1, ... rapidly gives a value which is x raised to a vast power (the multiplicity, or weight, of x). This patch fixes the computation of weights by correctly computing them no matter how big they are, rather than just overflowing and getting a wrong value. It turns out that the weight for a value never needs more bits to represent than the value itself, so it is enough to represent weights as APInts of the same bitwidth and do the right overflow-avoiding dance steps when computing weights. As a side-effect it reduces the number of multiplies needed in some cases of large powers. While there, in view of external uses (eg by the vectorizer) I made LinearizeExprTree static, pushing the rank computation out into users. This is progress towards fixing PR13021. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158358 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a problem with incomplete equality testing of PHINodes in Joel Jones2012-05-10
| | | | | | | | | | | | | | | | | | | | | | Instruction::IsIdenticalToWhenDefined. This manifested itself when inlining two calls to the same function. The inlined function had a switch statement that returned one of a set of global variables. Without this modification, the two phi instructions that chose values from the branches of the switch instruction inlined from the callee were considered equivalent and jump-threading replaced a load for the first switch value with a phi selecting from the second switch, thereby producing incorrect code. This patch has been tested with "make check-all", "lnt runteste nt", and llvm self-hosted, and on the original program that had this problem, wireshark. <rdar://problem/11025519> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156548 91177308-0d34-0410-b5e6-96231b3b80d8
* [unwind removal] Remove all of the code for the dead 'unwind' instruction. ThereBill Wendling2012-02-06
| | | | | | | | were no 'unwind' instructions being generated before this, so this is in effect a no-op. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149906 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unreachable code. (replace with llvm_unreachable to help GCC where ↵David Blaikie2012-01-17
| | | | | | necessary) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148284 91177308-0d34-0410-b5e6-96231b3b80d8
* Move Instruction::isSafeToSpeculativelyExecute out of VMCore andDan Gohman2011-12-14
| | | | | | | | | | into Analysis as a standalone function, since there's no need for it to be in VMCore. Also, update it to use isKnownNonZero and other goodies available in Analysis, making it more precise, enabling more aggressive optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146610 91177308-0d34-0410-b5e6-96231b3b80d8
* Make isSafeToSpeculativelyExecute() return the right answer for some new ↵Eli Friedman2011-09-01
| | | | | | instructions. Found by inspection; not sure what practical impact, if any, this has. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138962 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r137655. There is some question about whether the 'landingpad'Bill Wendling2011-08-17
| | | | | | | instruction should be marked as potentially reading and/or writing memory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137863 91177308-0d34-0410-b5e6-96231b3b80d8
* The resume instruction may throw. Return 'true' in this case.Bill Wendling2011-08-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137757 91177308-0d34-0410-b5e6-96231b3b80d8
* Duncan pointed out that the LandingPadInst might read memory. (It might alsoBill Wendling2011-08-15
| | | | | | | write to memory.) Marking it as such makes some checks for immobility go away. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137655 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix predicates methods on Instruction to handle atomic load/store correctly.Eli Friedman2011-08-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137652 91177308-0d34-0410-b5e6-96231b3b80d8
* Initial commit of the 'landingpad' instruction.Bill Wendling2011-08-12
| | | | | | | | | | | | | This implements the 'landingpad' instruction. It's used to indicate that a basic block is a landing pad. There are several restrictions on its use (see LangRef.html for more detail). These restrictions allow the exception handling code to gather the information it needs in a much more sane way. This patch has the definition, implementation, C interface, parsing, and bitcode support in it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137501 91177308-0d34-0410-b5e6-96231b3b80d8
* Add the 'resume' instruction for the new EH rewrite.Bill Wendling2011-07-31
| | | | | | | | | | This adds the 'resume' instruction class, IR parsing, and bitcode reading and writing. The 'resume' instruction resumes propagation of an existing (in-flight) exception whose unwinding was interrupted with a 'landingpad' instruction (to be added later). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136589 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,Bill Wendling2011-07-30
| | | | | | | | | r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444, r136445, r136446, r136253 pending review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136556 91177308-0d34-0410-b5e6-96231b3b80d8
* Misc optimizer+codegen work for 'cmpxchg' and 'atomicrmw'. They appear to beEli Friedman2011-07-29
| | | | | | | | | | | working on x86 (at least for trivial testcases); other architectures will need more work so that they actually emit the appropriate instructions for orderings stricter than 'monotonic'. (As far as I can tell, the ARM, PPC, Mips, and Alpha backends need such changes.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136457 91177308-0d34-0410-b5e6-96231b3b80d8
* LangRef and basic memory-representation/reading/writing for 'cmpxchg' andEli Friedman2011-07-28
| | | | | | | | | | | | | | | | | | | | | | | 'atomicrmw' instructions, which allow representing all the current atomic rmw intrinsics. The allowed operands for these instructions are heavily restricted at the moment; we can probably loosen it a bit, but supporting general first-class types (where it makes sense) might get a bit complicated, given how SelectionDAG works. As an initial cut, these operations do not support specifying an alignment, but it would be possible to add if we think it's useful. Specifying an alignment lower than the natural alignment would be essentially impossible to support on anything other than x86, but specifying a greater alignment would be possible. I can't think of any useful optimizations which would use that information, but maybe someone else has ideas. Optimizer/codegen support coming soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136404 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge the contents from exception-handling-rewrite to the mainline.Bill Wendling2011-07-27
| | | | | | | This adds the new instructions 'landingpad' and 'resume'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136253 91177308-0d34-0410-b5e6-96231b3b80d8
* Misc mid-level changes for new 'fence' instruction.Eli Friedman2011-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136205 91177308-0d34-0410-b5e6-96231b3b80d8
* Initial implementation of 'fence' instruction, the new C++0x-style ↵Eli Friedman2011-07-25
| | | | | | | | | | replacement for llvm.memory.barrier. This is just a LangRef entry and reading/writing/memory representation; optimizer+codegen support coming soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136009 91177308-0d34-0410-b5e6-96231b3b80d8
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
* manually copy debugloc over to a new instruction in clone() insteadChris Lattner2011-07-14
| | | | | | | | of calling getAllMetadata(). This is semantically identical, but doing it this way avoids unpacking the DebugLoc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135173 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.Jay Foad2011-07-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135040 91177308-0d34-0410-b5e6-96231b3b80d8
* AttrListPtr has an overloaded operator== which does this for us, we should useNick Lewycky2011-01-26
| | | | | | | it. No functionality change! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124286 91177308-0d34-0410-b5e6-96231b3b80d8
* There is no need for isAssociative to take the type as an argument anymore.Duncan Sands2010-12-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122242 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out Instruction::isSafeToSpeculativelyExecute's code forDan Gohman2010-11-11
| | | | | | | | | | | | | testing for dereferenceable pointers into a helper function, isDereferenceablePointer. Teach it how to reason about GEPs with simple non-zero indices. Also eliminate ArgumentPromtion's IsAlwaysValidPointer, which didn't check for weak externals or out of range gep indices. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118840 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename removeAllMetadata to clearMetadataHashEntries and simplifyDan Gohman2010-07-20
| | | | | | | | it to just do the things that need to be done when an instruction is deleted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108948 91177308-0d34-0410-b5e6-96231b3b80d8
* cache dereferenced iteratorsGabor Greif2010-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108131 91177308-0d34-0410-b5e6-96231b3b80d8
* If it's safe to speculatively execute load(alloca) the it's safe to executeNick Lewycky2010-07-11
| | | | | | | | load(gep(alloca)) where the gep is all-zeros. There's more we could do here but this is a common case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108101 91177308-0d34-0410-b5e6-96231b3b80d8
* IndirectBr is not safe to speculatively execute (!)Dan Gohman2010-07-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107454 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch the representation of the location in instruction fromChris Lattner2010-04-01
| | | | | | | | | | | | | | | being a TrackingVH<MDNode> to a NewDebugLoc, shrinking sizeof(Instruction) a lot, and providing clients the ability to deal with locations in terms of NewDebugLoc instead of having to deal with Metadata. This is still fully compatible with all clients that *do* use MDNodes for everything of course. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100088 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a major source of compile-time slowness at -O0 -g by optimizingChris Lattner2010-03-30
| | | | | | | | | | | | | | | the storage of !dbg metadata kinds in the instruction themselves. The on-the-side hash table works great for metadata that not-all instructions get, or for metadata that only exists when optimizing. But when compile-time is everything, it isn't great. I'm not super thrilled with the fact that this plops a TrackingVH in Instruction, because it grows it by 3 words. I'm investigating alternatives, but this should be a step in the right direction in any case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99957 91177308-0d34-0410-b5e6-96231b3b80d8
* rename use_const_iterator to const_use_iterator for consistency's sakeGabor Greif2010-03-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99564 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment.Dan Gohman2010-01-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92492 91177308-0d34-0410-b5e6-96231b3b80d8
* it isn't safe to speculative load from a malloc, it might haveChris Lattner2010-01-03
| | | | | | | | returned null, and may not have been big enough in any case. Thanks to Jay Foad for pointing this out! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92452 91177308-0d34-0410-b5e6-96231b3b80d8
* remove some unneeded Metadata interfaces.Chris Lattner2009-12-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92252 91177308-0d34-0410-b5e6-96231b3b80d8
* sink the Instruction::HasMetadata bit into SubclassData.Chris Lattner2009-12-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92240 91177308-0d34-0410-b5e6-96231b3b80d8
* This is a major cleanup of the instruction metadata interfaces thatChris Lattner2009-12-28
| | | | | | | | | | | | | | | | | | | | | | | I asked Devang to do back on Sep 27. Instead of going through the MetadataContext class with methods like getMD() and getMDs(), just ask the instruction directly for its metadata with getMetadata() and getAllMetadata(). This includes a variety of other fixes and improvements: previously all Value*'s were bloated because the HasMetadata bit was thrown into value, adding a 9th bit to a byte. Now this is properly sunk down to the Instruction class (the only place where it makes sense) and it will be folded away somewhere soon. This also fixes some confusion in getMDs and its clients about whether the returned list is indexed by the MDID or densely packed. This is now returned sorted and densely packed and the comments make this clear. This introduces a number of fixme's which I'll follow up on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92235 91177308-0d34-0410-b5e6-96231b3b80d8
* Changes requested (avoid getFunction(), avoid Type creation via isVoidTy(), ↵Victor Hernandez2009-11-03
| | | | | | and avoid redundant isFreeCall cases) in feedback to r85176 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85936 91177308-0d34-0410-b5e6-96231b3b80d8
* rename indbr -> indirectbr to appease the residents of #llvm.Chris Lattner2009-10-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85351 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out redundancy from clone() implementations.Devang Patel2009-10-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85327 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename MallocFreeHelper as MemoryBuiltinsVictor Hernandez2009-10-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85286 91177308-0d34-0410-b5e6-96231b3b80d8
* add enough support for indirect branch for the feature test to passChris Lattner2009-10-27
| | | | | | | | | (assembler,asmprinter, bc reader+writer) and document it. Codegen currently aborts on it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85274 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename MallocHelper as MallocFreeHelper, since it now also identifies calls ↵Victor Hernandez2009-10-26
| | | | | | to free() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85181 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove FreeInst.Victor Hernandez2009-10-26
| | | | | | | | | Remove LowerAllocations pass. Update some more passes to treate free calls just like they were treating FreeInst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85176 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove AllocationInst. Since MallocInst went away, AllocaInst is the only ↵Victor Hernandez2009-10-23
| | | | | | subclass of AllocationInst, so it no longer is necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84969 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove MallocInst from LLVM Instructions.Victor Hernandez2009-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84299 91177308-0d34-0410-b5e6-96231b3b80d8
* Move parent assertion check before metadata deletion.Devang Patel2009-09-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82692 91177308-0d34-0410-b5e6-96231b3b80d8