summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Instruction.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Refactor operation equivalence checking in BBVectorize by extending ↵Hal Finkel2012-06-281-5/+16
| | | | | | | | | | | 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. llvm-svn: 159329
* Now that Reassociate's LinearizeExprTree can look through arbitrary expressionDuncan Sands2012-06-121-0/+23
| | | | | | | | | | | | | | | | | 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. llvm-svn: 158358
* Fix a problem with incomplete equality testing of PHINodes in Joel Jones2012-05-101-1/+8
| | | | | | | | | | | | | | | | | | | | 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> llvm-svn: 156548
* [unwind removal] Remove all of the code for the dead 'unwind' instruction. ThereBill Wendling2012-02-061-1/+0
| | | | | | | were no 'unwind' instructions being generated before this, so this is in effect a no-op. llvm-svn: 149906
* Remove unreachable code. (replace with llvm_unreachable to help GCC where ↵David Blaikie2012-01-171-2/+0
| | | | | | necessary) llvm-svn: 148284
* Move Instruction::isSafeToSpeculativelyExecute out of VMCore andDan Gohman2011-12-141-53/+0
| | | | | | | | | 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. llvm-svn: 146610
* Make isSafeToSpeculativelyExecute() return the right answer for some new ↵Eli Friedman2011-09-011-0/+4
| | | | | | instructions. Found by inspection; not sure what practical impact, if any, this has. llvm-svn: 138962
* Revert r137655. There is some question about whether the 'landingpad'Bill Wendling2011-08-171-2/+0
| | | | | | instruction should be marked as potentially reading and/or writing memory. llvm-svn: 137863
* The resume instruction may throw. Return 'true' in this case.Bill Wendling2011-08-161-1/+1
| | | | llvm-svn: 137757
* Duncan pointed out that the LandingPadInst might read memory. (It might alsoBill Wendling2011-08-151-0/+2
| | | | | | write to memory.) Marking it as such makes some checks for immobility go away. llvm-svn: 137655
* Fix predicates methods on Instruction to handle atomic load/store correctly.Eli Friedman2011-08-151-7/+15
| | | | llvm-svn: 137652
* Initial commit of the 'landingpad' instruction.Bill Wendling2011-08-121-0/+1
| | | | | | | | | | | | 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. llvm-svn: 137501
* Add the 'resume' instruction for the new EH rewrite.Bill Wendling2011-07-311-0/+1
| | | | | | | | | 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). llvm-svn: 136589
* Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,Bill Wendling2011-07-301-2/+0
| | | | | | | r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444, r136445, r136446, r136253 pending review. llvm-svn: 136556
* Misc optimizer+codegen work for 'cmpxchg' and 'atomicrmw'. They appear to beEli Friedman2011-07-291-2/+24
| | | | | | | | | 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.) llvm-svn: 136457
* LangRef and basic memory-representation/reading/writing for 'cmpxchg' andEli Friedman2011-07-281-0/+2
| | | | | | | | | | | | | | | | | | | | | '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. llvm-svn: 136404
* Merge the contents from exception-handling-rewrite to the mainline.Bill Wendling2011-07-271-0/+2
| | | | | | This adds the new instructions 'landingpad' and 'resume'. llvm-svn: 136253
* Misc mid-level changes for new 'fence' instruction.Eli Friedman2011-07-271-0/+9
| | | | llvm-svn: 136205
* Initial implementation of 'fence' instruction, the new C++0x-style ↵Eli Friedman2011-07-251-0/+1
| | | | | | | | replacement for llvm.memory.barrier. This is just a LangRef entry and reading/writing/memory representation; optimizer+codegen support coming soon. llvm-svn: 136009
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-2/+2
| | | | llvm-svn: 135375
* manually copy debugloc over to a new instruction in clone() insteadChris Lattner2011-07-141-1/+3
| | | | | | | of calling getAllMetadata(). This is semantically identical, but doing it this way avoids unpacking the DebugLoc. llvm-svn: 135173
* Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.Jay Foad2011-07-131-32/+8
| | | | llvm-svn: 135040
* AttrListPtr has an overloaded operator== which does this for us, we should useNick Lewycky2011-01-261-8/+5
| | | | | | it. No functionality change! llvm-svn: 124286
* There is no need for isAssociative to take the type as an argument anymore.Duncan Sands2010-12-201-1/+1
| | | | llvm-svn: 122242
* Factor out Instruction::isSafeToSpeculativelyExecute's code forDan Gohman2010-11-111-18/+3
| | | | | | | | | | | | 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. llvm-svn: 118840
* Rename removeAllMetadata to clearMetadataHashEntries and simplifyDan Gohman2010-07-201-2/+2
| | | | | | | it to just do the things that need to be done when an instruction is deleted. llvm-svn: 108948
* cache dereferenced iteratorsGabor Greif2010-07-121-2/+3
| | | | llvm-svn: 108131
* If it's safe to speculatively execute load(alloca) the it's safe to executeNick Lewycky2010-07-111-3/+11
| | | | | | | load(gep(alloca)) where the gep is all-zeros. There's more we could do here but this is a common case. llvm-svn: 108101
* IndirectBr is not safe to speculatively execute (!)Dan Gohman2010-07-021-0/+1
| | | | llvm-svn: 107454
* Switch the representation of the location in instruction fromChris Lattner2010-04-011-2/+2
| | | | | | | | | | | | | 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. llvm-svn: 100088
* Fix a major source of compile-time slowness at -O0 -g by optimizingChris Lattner2010-03-301-2/+2
| | | | | | | | | | | | | | 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. llvm-svn: 99957
* rename use_const_iterator to const_use_iterator for consistency's sakeGabor Greif2010-03-251-1/+1
| | | | llvm-svn: 99564
* Add a comment.Dan Gohman2010-01-041-0/+2
| | | | llvm-svn: 92492
* it isn't safe to speculative load from a malloc, it might haveChris Lattner2010-01-031-32/+1
| | | | | | | returned null, and may not have been big enough in any case. Thanks to Jay Foad for pointing this out! llvm-svn: 92452
* remove some unneeded Metadata interfaces.Chris Lattner2009-12-291-6/+11
| | | | llvm-svn: 92252
* sink the Instruction::HasMetadata bit into SubclassData.Chris Lattner2009-12-291-6/+4
| | | | llvm-svn: 92240
* This is a major cleanup of the instruction metadata interfaces thatChris Lattner2009-12-281-7/+7
| | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 92235
* Changes requested (avoid getFunction(), avoid Type creation via isVoidTy(), ↵Victor Hernandez2009-11-031-37/+5
| | | | | | and avoid redundant isFreeCall cases) in feedback to r85176 llvm-svn: 85936
* rename indbr -> indirectbr to appease the residents of #llvm.Chris Lattner2009-10-281-1/+1
| | | | llvm-svn: 85351
* Factor out redundancy from clone() implementations.Devang Patel2009-10-271-0/+8
| | | | llvm-svn: 85327
* Rename MallocFreeHelper as MemoryBuiltinsVictor Hernandez2009-10-271-2/+2
| | | | llvm-svn: 85286
* add enough support for indirect branch for the feature test to passChris Lattner2009-10-271-0/+1
| | | | | | | (assembler,asmprinter, bc reader+writer) and document it. Codegen currently aborts on it. llvm-svn: 85274
* Rename MallocHelper as MallocFreeHelper, since it now also identifies calls ↵Victor Hernandez2009-10-261-2/+2
| | | | | | to free() llvm-svn: 85181
* Remove FreeInst.Victor Hernandez2009-10-261-5/+43
| | | | | | | Remove LowerAllocations pass. Update some more passes to treate free calls just like they were treating FreeInst. llvm-svn: 85176
* Remove AllocationInst. Since MallocInst went away, AllocaInst is the only ↵Victor Hernandez2009-10-231-1/+1
| | | | | | subclass of AllocationInst, so it no longer is necessary. llvm-svn: 84969
* Remove MallocInst from LLVM Instructions.Victor Hernandez2009-10-171-2/+0
| | | | llvm-svn: 84299
* Move parent assertion check before metadata deletion.Devang Patel2009-09-241-1/+1
| | | | llvm-svn: 82692
* Delete attached metadata when an instruction is deleted.Devang Patel2009-09-231-0/+5
| | | | llvm-svn: 82647
* Tabs -> spaces, and remove trailing whitespace.Daniel Dunbar2009-09-201-4/+4
| | | | llvm-svn: 82355
* Update malloc call creation code (AllocType is now the element type of the ↵Victor Hernandez2009-09-181-1/+23
| | | | | | | | | | | | | | | | | | malloc, not the resulting type). In getMallocArraySize(), fix bug in the case that array size is the product of 2 constants. Extend isArrayMalloc() and getMallocArraySize() to handle case where malloc is used as char array. Ensure that ArraySize in LowerAllocations::runOnBasicBlock() is correct type. Extend Instruction::isSafeToSpeculativelyExecute() to handle malloc calls. Add verification for malloc calls. Reviewed by Dan Gohman. llvm-svn: 82257
OpenPOWER on IntegriCloud