Fix the last of the silly bugs I just introduced. :(
authorChris Lattner <sabre@nondot.org>
Tue, 10 Sep 2002 23:46:10 +0000 (23:46 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 10 Sep 2002 23:46:10 +0000 (23:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3674 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/ADCE.cpp

index 3aca4a2d4cd6362feda04f0688cd2918c12cf634..7d1d896bd226d6f1f353243a8c5a16fc72952eb5 100644 (file)
@@ -240,7 +240,7 @@ bool ADCE::doADCE() {
     //
     if (!AliveBlocks.count(&Func->front())) {
       BasicBlock *NewEntry = new BasicBlock();
-      new BranchInst(&Func->front(), NewEntry->end());
+      NewEntry->getInstList().push_back(new BranchInst(&Func->front()));
       Func->getBasicBlockList().push_front(NewEntry);
       AliveBlocks.insert(NewEntry);    // This block is always alive!
     }
@@ -353,8 +353,8 @@ bool ADCE::doADCE() {
         // Delete the old terminator instruction...
         BB->getInstList().pop_back();
         const Type *RetTy = Func->getReturnType();
-        new ReturnInst(RetTy != Type::VoidTy ? Constant::getNullValue(RetTy) :0,
-                       BB->end());
+        BB->getInstList().push_back(new ReturnInst(RetTy != Type::VoidTy ?
+                                           Constant::getNullValue(RetTy) : 0));
       }
 
       BB->dropAllReferences();