summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp
Commit message (Collapse)AuthorAgeFilesLines
* InequalityGraph::node() can create new nodes, invalidating iterators acrossNick Lewycky2008-05-271-0/+1
| | | | | | | the set of nodes. Fix makeEqual to handle this by creating the new node first then iterating across them second. llvm-svn: 51573
* Grammaro.Nick Lewycky2008-05-261-1/+1
| | | | llvm-svn: 51572
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-131-4/+4
| | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. llvm-svn: 51017
* Remove unnecessary <sstream> includes.Dan Gohman2008-04-141-1/+0
| | | | llvm-svn: 49681
* Fix "Control reaches the end of non-void function" warnings, Chris Lattner2008-03-301-0/+2
| | | | | | patch by David Chisnall. llvm-svn: 48963
* De-tabify.Bill Wendling2008-02-261-2/+2
| | | | llvm-svn: 47599
* Add explicit keywords.Dan Gohman2008-02-201-1/+1
| | | | llvm-svn: 47382
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.Duncan Sands2007-11-011-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The meaning of getTypeSize was not clear - clarifying it is important now that we have x86 long double and arbitrary precision integers. The issue with long double is that it requires 80 bits, and this is not a multiple of its alignment. This gives a primitive type for which getTypeSize differed from getABITypeSize. For arbitrary precision integers it is even worse: there is the minimum number of bits needed to hold the type (eg: 36 for an i36), the maximum number of bits that will be overwriten when storing the type (40 bits for i36) and the ABI size (i.e. the storage size rounded up to a multiple of the alignment; 64 bits for i36). This patch removes getTypeSize (not really - it is still there but deprecated to allow for a gradual transition). Instead there is: (1) getTypeSizeInBits - a number of bits that suffices to hold all values of the type. For a primitive type, this is the minimum number of bits. For an i36 this is 36 bits. For x86 long double it is 80. This corresponds to gcc's TYPE_PRECISION. (2) getTypeStoreSizeInBits - the maximum number of bits that is written when storing the type (or read when reading it). For an i36 this is 40 bits, for an x86 long double it is 80 bits. This is the size alias analysis is interested in (getTypeStoreSize returns the number of bytes). There doesn't seem to be anything corresponding to this in gcc. (3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded up to a multiple of the alignment. For an i36 this is 64, for an x86 long double this is 96 or 128 depending on the OS. This is the spacing between consecutive elements when you form an array out of this type (getABITypeSize returns the number of bytes). This is TYPE_SIZE in gcc. Since successive elements in a SequentialType (arrays, pointers and vectors) need to be aligned, the spacing between them will be given by getABITypeSize. This means that the size of an array is the length times the getABITypeSize. It also means that GEP computations need to use getABITypeSize when computing offsets. Furthermore, if an alloca allocates several elements at once then these too need to be aligned, so the size of the alloca has to be the number of elements multiplied by getABITypeSize. Logically speaking this doesn't have to be the case when allocating just one element, but it is simpler to also use getABITypeSize in this case. So alloca's and mallocs should use getABITypeSize. Finally, since gcc's only notion of size is that given by getABITypeSize, if you want to output assembler etc the same as gcc then getABITypeSize is the size you want. Since a store will overwrite no more than getTypeStoreSize bytes, and a read will read no more than that many bytes, this is the notion of size appropriate for alias analysis calculations. In this patch I have corrected all type size uses except some of those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard cases). I will get around to auditing these too at some point, but I could do with some help. Finally, I made one change which I think wise but others might consider pointless and suboptimal: in an unpacked struct the amount of space allocated for a field is now given by the ABI size rather than getTypeStoreSize. I did this because every other place that reserves memory for a type (eg: alloca) now uses getABITypeSize, and I didn't want to make an exception for unpacked structs, i.e. I did it to make things more uniform. This only effects structs containing long doubles and arbitrary precision integers. If someone wants to pack these types more tightly they can always use a packed struct. llvm-svn: 43620
* Fix optimization. %x = sub %x, %y does not imply that %y is zero.Nick Lewycky2007-09-201-1/+1
| | | | llvm-svn: 42157
* Oops, remove assert that wasn't meant to be committed.Nick Lewycky2007-08-181-2/+0
| | | | llvm-svn: 41170
* Never insert duplicate edges.Nick Lewycky2007-08-181-13/+17
| | | | llvm-svn: 41169
* Clean up comments, fix up some confusing code logic.Nick Lewycky2007-08-041-30/+47
| | | | | | Predsimplify fails llvm-gcc bootstrap. llvm-svn: 40815
* Start adding and cleaning up comments.Nick Lewycky2007-07-161-4/+12
| | | | llvm-svn: 39894
* Use maximal intersection algorithm exclusively. Fixes miscompile bug.Nick Lewycky2007-07-141-11/+11
| | | | llvm-svn: 39852
* Update the ValueRanges interface to use value numbers instead of Value*s.Nick Lewycky2007-07-101-255/+297
| | | | llvm-svn: 38483
* Break "variable canonicalization" out of InequalityGraph and into its own classNick Lewycky2007-07-051-269/+287
| | | | | | "ValueNumbering". llvm-svn: 37881
* Fix value ranges.Nick Lewycky2007-06-241-1/+1
| | | | llvm-svn: 37713
* Remove tabs.Nick Lewycky2007-06-241-2/+2
| | | | llvm-svn: 37710
* Remove use of ETForest. Also cleaned up issues around unreachable basicNick Lewycky2007-06-241-156/+326
| | | | | | blocks, and optimizing within one basic block. llvm-svn: 37709
* Patches by Chuck Rose to unbreak V Studio builds.Bill Wendling2007-06-041-0/+15
| | | | | | Thanks Chuck! llvm-svn: 37428
* s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/gDevang Patel2007-06-041-11/+11
| | | | llvm-svn: 37407
* s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/gDevang Patel2007-06-031-11/+11
| | | | llvm-svn: 37403
* Fix typo in comment.Nick Lewycky2007-05-061-1/+1
| | | | llvm-svn: 36873
* Drop 'const'Devang Patel2007-05-031-2/+2
| | | | llvm-svn: 36662
* Use 'static const char' instead of 'static const int'.Devang Patel2007-05-021-2/+2
| | | | | | | Due to darwin gcc bug, one version of darwin linker coalesces static const int, which defauts PassID based pass identification. llvm-svn: 36652
* Do not use typeinfo to identify pass in pass manager.Devang Patel2007-05-011-0/+4
| | | | llvm-svn: 36632
* Using APInt more efficiently.Zhou Sheng2007-04-261-5/+4
| | | | llvm-svn: 36475
* Undo my previous changes. Since my approach to this problem is being revised,Owen Anderson2007-04-251-32/+31
| | | | | | this approach is no longer appropriate. llvm-svn: 36421
* Make PredicateSimplifier not use DominatorTree.Owen Anderson2007-04-211-31/+32
| | | | llvm-svn: 36300
* Make the operations of APInt variables more efficient.Zhou Sheng2007-04-191-27/+21
| | | | llvm-svn: 36260
* fix long linesChris Lattner2007-04-141-2/+3
| | | | llvm-svn: 36031
* Add support for cast instructions.Nick Lewycky2007-04-071-17/+75
| | | | llvm-svn: 35734
* Support NE inequality in ValueRanges.Nick Lewycky2007-04-071-3/+58
| | | | llvm-svn: 35724
* Cleanup. Refactor out the applying of value ranges to its own method.Nick Lewycky2007-04-071-30/+35
| | | | llvm-svn: 35719
* Use TargetData to find the size of a type.Nick Lewycky2007-04-071-13/+34
| | | | llvm-svn: 35718
* Strengthen icmp snuggling by doing 'compare-or-equal-to' to 'compare'Nick Lewycky2007-04-071-16/+23
| | | | | | first and then range testing second. llvm-svn: 35715
* Fix broken optimization disabled by a logic bug.Nick Lewycky2007-03-221-10/+51
| | | | | | | | | Analyze GEPs. If the indices are all zero, transfer whether the pointer is known to be not null through the GEP. Add a few more cases for xor and shift instructions. llvm-svn: 35257
* Clean up this code and fix subtract miscompile.Nick Lewycky2007-03-181-18/+22
| | | | llvm-svn: 35146
* Propagate ValueRanges across equality.Nick Lewycky2007-03-181-67/+159
| | | | | | Add some more micro-optimizations: x * 0 = 0, a - x = a --> x = 0. llvm-svn: 35138
* Silence warningAnton Korobeynikov2007-03-171-2/+2
| | | | llvm-svn: 35137
* Add more comments and update to new asm syntax.Nick Lewycky2007-03-161-28/+130
| | | | | | | | | | Add new micro-optimizations. Add icmp predicate snuggling. Given %x ULT 4, "icmp ugt %x, 2" becomes "icmp eq %x, 3". This doesn't apply in any non-trivial cases yet due to missing support for NE values in ValueRanges. llvm-svn: 35119
* Add value ranges. Currently inefficient in both execution time andNick Lewycky2007-03-101-219/+397
| | | | | | optimization power. llvm-svn: 35058
* Unbreak VC++ build.Jeff Cohen2007-03-051-1/+1
| | | | llvm-svn: 34917
* Translate bit operations to English.Nick Lewycky2007-03-031-1/+2
| | | | llvm-svn: 34868
* APIntify this pass.Reid Spencer2007-03-031-28/+36
| | | | llvm-svn: 34863
* Fix indenting, remove tabs.Nick Lewycky2007-02-041-32/+90
| | | | | | | | | | | | Learn from sext and zext. The destination value falls within the range of the source type. Generalize properties regarding constant ints. Get smarter about marking blocks as unreachable. If 1 >= 2 in order for this block to execute, then it isn't reachable. llvm-svn: 33889
* For PR1163:Reid Spencer2007-02-041-1/+1
| | | | | | | Make the Module's dependent library use a std::vector instead of SetVector adjust #includes in .cpp files because SetVector.h is no longer included. llvm-svn: 33855
* Simplify names of lattice values. SGTUNE becomes SGT, for example.Nick Lewycky2007-01-291-71/+127
| | | | | | | | | | | | | Fix initializeConstant, now initializeInt. Fixes major performance bottleneck. X == Y || X->DominatedBy(Y) is redundant. Remove the X == Y part. Fix crasher in makeEqual where getOrInsertNode would add a new constant, producing an NE relationship between the two members we're trying to make equal. This now allows us to mark more BBs as unreachable. llvm-svn: 33612
* For PR1094:Reid Spencer2007-01-171-4/+4
| | | | | | | Adjust the use of SetVector for changes in SetVector's interface. Patch by Gordon Henriksen. llvm-svn: 33280
OpenPOWER on IntegriCloud