aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp7
-rw-r--r--lib/Transforms/Scalar/LICM.cpp6
-rw-r--r--lib/Transforms/Scalar/PiNodeInsertion.cpp9
3 files changed, 7 insertions, 15 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 15b71fdf55..3aca4a2d4c 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -240,7 +240,7 @@ bool ADCE::doADCE() {
//
if (!AliveBlocks.count(&Func->front())) {
BasicBlock *NewEntry = new BasicBlock();
- NewEntry->getInstList().push_back(new BranchInst(&Func->front()));
+ new BranchInst(&Func->front(), NewEntry->end());
Func->getBasicBlockList().push_front(NewEntry);
AliveBlocks.insert(NewEntry); // This block is always alive!
}
@@ -353,9 +353,8 @@ bool ADCE::doADCE() {
// Delete the old terminator instruction...
BB->getInstList().pop_back();
const Type *RetTy = Func->getReturnType();
- Instruction *New = new ReturnInst(RetTy != Type::VoidTy ?
- Constant::getNullValue(RetTy) : 0);
- BB->getInstList().push_back(New);
+ new ReturnInst(RetTy != Type::VoidTy ? Constant::getNullValue(RetTy) :0,
+ BB->end());
}
BB->dropAllReferences();
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 37333db111..7bae9fd18a 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -241,10 +241,8 @@ void LICM::hoist(Instruction &Inst) {
// No loop pre-header, insert a PHI node into header to capture all of the
// incoming versions of the value.
//
- PHINode *LoopVal = new PHINode(Inst.getType(), InstName+".phi");
-
- // Insert the new PHI node into the loop header...
- Header->getInstList().push_front(LoopVal);
+ PHINode *LoopVal = new PHINode(Inst.getType(), InstName+".phi",
+ Header->begin());
// Insert cloned versions of the instruction into all of the loop preds.
for (unsigned i = 0, e = LoopPreds.size(); i != e; ++i) {
diff --git a/lib/Transforms/Scalar/PiNodeInsertion.cpp b/lib/Transforms/Scalar/PiNodeInsertion.cpp
index bf0119f2f3..940b56fd29 100644
--- a/lib/Transforms/Scalar/PiNodeInsertion.cpp
+++ b/lib/Transforms/Scalar/PiNodeInsertion.cpp
@@ -148,13 +148,8 @@ bool PiNodeInserter::insertPiNodeFor(Value *V, BasicBlock *Succ, Value *Rep) {
// Create the Pi node...
Value *Pi = Rep;
- if (Rep == 0) {
- PHINode *Phi = new PHINode(V->getType(), V->getName() + ".pi");
-
- // Insert the Pi node in the successor basic block...
- Succ->getInstList().push_front(Phi);
- Pi = Phi;
- }
+ if (Rep == 0) // Insert the Pi node in the successor basic block...
+ Pi = new PHINode(V->getType(), V->getName() + ".pi", Succ->begin());
// Loop over all of the uses of V, replacing ones that the Pi node
// dominates with references to the Pi node itself.