summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove code for updating dominance frontiers and some outdated references toCameron Zwarich2011-01-184-96/+20
| | | | | | dominance and post-dominance frontiers. llvm-svn: 123725
* Remove outdated references to dominance frontiers.Cameron Zwarich2011-01-182-10/+8
| | | | llvm-svn: 123724
* Roll r123609 back in with two changes that fix test failures with expensiveCameron Zwarich2011-01-172-54/+120
| | | | | | | | | | | | | | checks enabled: 1) Use '<' to compare integers in a comparison function rather than '<='. 2) Use the uniqued set DefBlocks rather than Info.DefiningBlocks to initialize the priority queue. The speedup of scalarrepl on test-suite + SPEC2000 + SPEC2006 is a bit less, at just under 16% rather than 17%. llvm-svn: 123662
* Roll out r123609 due to failures on the llvm-x86_64-linux-checks bot.Cameron Zwarich2011-01-172-119/+53
| | | | llvm-svn: 123618
* Eliminate the use of dominance frontiers in PromoteMemToReg. In addition toCameron Zwarich2011-01-172-53/+119
| | | | | | | | | | | | | eliminating a potentially quadratic data structure, this also gives a 17% speedup when running -scalarrepl on test-suite + SPEC2000 + SPEC2006. My initial experiment gave a greater speedup around 25%, but I moved the dominator tree level computation from dominator tree construction to PromoteMemToReg. Since this approach to computing IDFs has a much lower overhead than the old code using precomputed DFs, it is worth looking at using this new code for the second scalarrepl pass as well. llvm-svn: 123609
* Generalize LoadAndStorePromoter a bit and switch LICMChris Lattner2011-01-151-16/+25
| | | | | | to use it. llvm-svn: 123501
* Add a new LoadAndStorePromoter class, which implements the generalChris Lattner2011-01-141-0/+154
| | | | | | | "promote a bunch of load and stores" logic, allowing the code to be shared and reused. llvm-svn: 123456
* indentationChris Lattner2011-01-141-1/+1
| | | | llvm-svn: 123426
* Fix a non-deterministic loop in llvm::MergeBlockIntoPredecessor.Jakob Stoklund Olesen2011-01-111-2/+2
| | | | | | | | | DT->changeImmediateDominator() trivially ignores identity updates, so there is really no need for the uniqueing provided by SmallPtrSet. I expect this to fix PR8954. llvm-svn: 123286
* this pass claims to preserve scev, make sure to tell it about deletions.Chris Lattner2011-01-111-0/+1
| | | | llvm-svn: 123247
* Factor the actual simplification out of SimplifyIndirectBrOnSelect and into ↵Frits van Bommel2011-01-111-26/+37
| | | | | | | | a new helper function so it can be reused in e.g. an upcoming SimplifySwitchOnSelect. No functional change. llvm-svn: 123234
* when MergeBlockIntoPredecessor merges two blocks, update MemDep if itChris Lattner2011-01-111-0/+4
| | | | | | is floating around in the ether. llvm-svn: 123223
* Fix FoldSingleEntryPHINodes to update memdep and AA when it deletesChris Lattner2011-01-111-3/+19
| | | | | | | | | | phi nodes. It is called from MergeBlockIntoPredecessor which is called from GVN, which claims to preserve these. I'm skeptical that this is the actual problem behind PR8954, but this is a stab in the right direction. llvm-svn: 123222
* random cleanupsChris Lattner2011-01-111-2/+2
| | | | llvm-svn: 123221
* various code cleanups, enhance MergeBlockIntoPredecessor to preserveChris Lattner2011-01-081-13/+10
| | | | | | loop info. llvm-svn: 123074
* reduce nesting.Chris Lattner2011-01-081-6/+6
| | | | llvm-svn: 123071
* Make more passes preserve dominators (or state that they preserve dominators ifCameron Zwarich2011-01-081-0/+7
| | | | | | | | | | they all ready do). This removes two dominator recomputations prior to isel, which is a 1% improvement in total llc time for 403.gcc. The only potentially suspect thing is making GCStrategy recompute dominators if it used a custom lowering strategy. llvm-svn: 123064
* Revamp the ValueMapper interfaces in a couple ways:Chris Lattner2011-01-083-120/+79
| | | | | | | | | | | | | | | | 1. Take a flags argument instead of a bool. This makes it more clear to the reader what it is used for. 2. Add a flag that says that "remapping a value not in the map is ok". 3. Reimplement MapValue to share a bunch of code and be a lot more efficient. For lookup failures, don't drop null values into the map. 4. Using the new flag a bunch of code can vaporize in LinkModules and LoopUnswitch, kill it. No functionality change. llvm-svn: 123058
* Remove all uses of the "ugly" method BranchInst::setUnconditionalDest().Jay Foad2011-01-072-6/+9
| | | | llvm-svn: 123025
* Speed up instsimplify by about 10-15% by not bothering to retryDuncan Sands2011-01-031-8/+19
| | | | | | | InstructionSimplify on instructions that didn't change since the last time round the loop. llvm-svn: 122745
* split dom frontier handling stuff out to its own DominanceFrontier header,Chris Lattner2011-01-027-29/+18
| | | | | | so that Dominators.h is *just* domtree. Also prune #includes a bit. llvm-svn: 122714
* Fix PR8702 by not having LoopSimplify claim to preserve LCSSA form. As ↵Duncan Sands2011-01-021-15/+12
| | | | | | | | | | described in the PR, the pass could break LCSSA form when inserting preheaders. It probably would be easy enough to fix this, but since currently we always go into LCSSA form after running this pass, doing so is not urgent. llvm-svn: 122695
* Simplify this pass by using a depth-first iterator to ensure that allDuncan Sands2010-12-311-39/+20
| | | | | | operands are visited before the instructions themselves. llvm-svn: 122647
* Zap dead instructions harder.Duncan Sands2010-12-311-7/+2
| | | | llvm-svn: 122645
* Make a bunch of symbols internal.Benjamin Kramer2010-12-301-1/+2
| | | | llvm-svn: 122642
* BuildLibCalls: Nuke EmitMemCpy, EmitMemMove and EmitMemSet. They are dead ↵Benjamin Kramer2010-12-271-49/+5
| | | | | | and superseded by IRBuilder. llvm-svn: 122576
* don't lose TD infoChris Lattner2010-12-251-1/+1
| | | | llvm-svn: 122556
* switch the inliner alignment enforcement stuff to use theChris Lattner2010-12-251-27/+8
| | | | | | | getOrEnforceKnownAlignment function, which simplifies the code and makes it stronger. llvm-svn: 122555
* Move getOrEnforceKnownAlignment out of instcombine into Transforms/Utils.Chris Lattner2010-12-251-0/+92
| | | | llvm-svn: 122554
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-232-2/+2
| | | | | | | new gcc warning that complains on self-assignments and self-initializations. llvm-svn: 122458
* Visit instructions deterministically. Use a FIFO so as to approximatelyDuncan Sands2010-12-211-11/+21
| | | | | | | visit instructions before their uses, since InstructionSimplify does a better job in that case. All this prompted by Frits van Bommel. llvm-svn: 122343
* If an instruction simplifies, try again to simplify any uses of it. This isDuncan Sands2010-12-211-4/+32
| | | | | | | not very important since the pass is only used for testing, but it does make it more realistic. Suggested by Frits van Bommel. llvm-svn: 122336
* Oops, forgot to add the pass itself!Duncan Sands2010-12-201-0/+69
| | | | llvm-svn: 122265
* Add a new convenience pass for testing InstructionSimplify. PreviouslyDuncan Sands2010-12-202-0/+2
| | | | | | | | | it could only be tested indirectly, via instcombine, gvn or some other pass that makes use of InstructionSimplify, which means that testcases had to be carefully contrived to dance around any other transformations that that pass did. llvm-svn: 122264
* when eliding a byval copy due to inlining a readonly function, we haveChris Lattner2010-12-201-4/+43
| | | | | | to make sure that the reused alloca has sufficient alignment. llvm-svn: 122236
* pull byval processing out to its own helper function.Chris Lattner2010-12-201-56/+72
| | | | llvm-svn: 122235
* fix PR8769, a miscompilation by inliner when inlining a function with a byvalChris Lattner2010-12-201-6/+10
| | | | | | | | argument. The generated alloca has to have at least the alignment of the byval, if not, the client may be making assumptions that the new alloca won't satisfy. llvm-svn: 122234
* simplify this a bit.Chris Lattner2010-12-181-2/+1
| | | | llvm-svn: 122156
* SimplifyCFG: Ranges can be larger than 64 bits. Fixes Release-selfhost build.Benjamin Kramer2010-12-171-1/+1
| | | | llvm-svn: 122054
* improve switch formation to handle small range Chris Lattner2010-12-171-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | comparisons formed by comparisons. For example, this: void foo(unsigned x) { if (x == 0 || x == 1 || x == 3 || x == 4 || x == 6) bar(); } compiles into: _foo: ## @foo ## BB#0: ## %entry cmpl $6, %edi ja LBB0_2 ## BB#1: ## %entry movl %edi, %eax movl $91, %ecx btq %rax, %rcx jb LBB0_3 instead of: _foo: ## @foo ## BB#0: ## %entry cmpl $2, %edi jb LBB0_4 ## BB#1: ## %switch.early.test cmpl $6, %edi ja LBB0_3 ## BB#2: ## %switch.early.test movl %edi, %eax movl $88, %ecx btq %rax, %rcx jb LBB0_4 This catches a bunch of cases in GCC, which look like this: %804 = load i32* @which_alternative, align 4, !tbaa !0 %805 = icmp ult i32 %804, 2 %806 = icmp eq i32 %804, 3 %or.cond121 = or i1 %805, %806 %807 = icmp eq i32 %804, 4 %or.cond124 = or i1 %or.cond121, %807 br i1 %or.cond124, label %.thread, label %808 turning this into a range comparison. llvm-svn: 122045
* make qsort predicate more conformant by returning 0 for equal values.Chris Lattner2010-12-151-1/+5
| | | | llvm-svn: 121838
* - Insert new instructions before DomBlock's terminator,Chris Lattner2010-12-141-7/+16
| | | | | | | | | | which is simpler than finding a place to insert in BB. - Don't perform the 'if condition hoisting' xform on certain i1 PHIs, as it interferes with switch formation. This re-fixes "example 7", without breaking the world hopefully. llvm-svn: 121764
* fix two significant issues with FoldTwoEntryPHINode:Chris Lattner2010-12-141-1/+11
| | | | | | | | | | | | | first, it can kick in on blocks whose conditions have been folded to a constant, even though one of the edges will be trivially folded. second, it doesn't clean up the "if diamond" that it just eliminated away. This is a problem because other simplifycfg xforms kick in depending on the order of block visitation, causing pointless work. llvm-svn: 121762
* remove the instsimplify logic I added in r121754. It is apparentlyChris Lattner2010-12-141-11/+1
| | | | | | breaking the selfhost builds, though I can't fathom how. llvm-svn: 121761
* clean up logic, convert std::set to SmallPtrSet, handle the caseChris Lattner2010-12-141-56/+61
| | | | | | when all 2-entry phis are simplified away. llvm-svn: 121760
* tidy up a bit, move DEBUG down to when we commit to doing the transform so we Chris Lattner2010-12-141-7/+5
| | | | | | don't print it unless the xform happens. llvm-svn: 121758
* use SimplifyInstruction instead of reimplementing part of it.Chris Lattner2010-12-141-10/+7
| | | | llvm-svn: 121757
* simplify GetIfCondition by using getSinglePredecessor.Chris Lattner2010-12-141-28/+24
| | | | llvm-svn: 121756
* use AddPredecessorToBlock in 3 places instead of a manual loop.Chris Lattner2010-12-141-18/+6
| | | | llvm-svn: 121755
* make FoldTwoEntryPHINode use instsimplify a bit, makeChris Lattner2010-12-141-12/+21
| | | | | | | GetIfCondition faster by avoiding pred_iterator. No really interesting change. llvm-svn: 121754
OpenPOWER on IntegriCloud