summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-08 19:11:57 +0000
committerChris Lattner <sabre@nondot.org>2005-08-08 19:11:57 +0000
commit9f269e40c9b5d9a08890d0545fce60de99989138 (patch)
tree0b77e3cc473dffd8b02cf761262b595aa05e70dd /llvm/lib/Transforms
parentd380d8412defb98d2ac1cc4c1843c72ef8aa794c (diff)
downloadbcm5719-llvm-9f269e40c9b5d9a08890d0545fce60de99989138.tar.gz
bcm5719-llvm-9f269e40c9b5d9a08890d0545fce60de99989138.zip
Use the new 'moveBefore' method to simplify some code. Really, which is
easier to understand? :) llvm-svn: 22706
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp3
-rw-r--r--llvm/lib/Transforms/Scalar/Reassociate.cpp5
-rw-r--r--llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp2
3 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index b9113a44600..67dca06a420 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -5238,8 +5238,7 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
BasicBlock::iterator InsertPos = DestBlock->begin();
while (isa<PHINode>(InsertPos)) ++InsertPos;
- BasicBlock *SrcBlock = I->getParent();
- DestBlock->getInstList().splice(InsertPos, SrcBlock->getInstList(), I);
+ I->moveBefore(InsertPos);
++NumSunkInst;
return true;
}
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
index 1bc6ebe4892..c55bce0d7e8 100644
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -184,7 +184,7 @@ void Reassociate::LinearizeExpr(BinaryOperator *I) {
// Move the RHS instruction to live immediately before I, avoiding breaking
// dominator properties.
- I->getParent()->getInstList().splice(I, RHS->getParent()->getInstList(), RHS);
+ RHS->moveBefore(I);
// Move operands around to do the linearization.
I->setOperand(1, RHS->getOperand(0));
@@ -261,8 +261,7 @@ void Reassociate::LinearizeExprTree(BinaryOperator *I,
// Move LHS right before I to make sure that the tree expression dominates all
// values.
- I->getParent()->getInstList().splice(I,
- LHSBO->getParent()->getInstList(), LHSBO);
+ LHSBO->moveBefore(I);
// Linearize the expression tree on the LHS.
LinearizeExprTree(LHSBO, Ops);
diff --git a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
index 2b67b439cb3..a8c2a3a8b77 100644
--- a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -363,7 +363,7 @@ bool TailCallElim::ProcessReturningBlock(ReturnInst *Ret, BasicBlock *&OldEntry,
NEBI = NewEntry->begin(); OEBI != E; )
if (AllocaInst *AI = dyn_cast<AllocaInst>(OEBI++))
if (isa<ConstantInt>(AI->getArraySize()))
- NewEntry->getInstList().splice(NEBI, OldEntry->getInstList(), AI);
+ AI->moveBefore(NEBI);
// Now that we have created a new block, which jumps to the entry
// block, insert a PHI node for each argument of the function.
OpenPOWER on IntegriCloud