[llvm-commits] [llvm] r167196 - /llvm/trunk/lib/Transforms/Scalar/SROA.cpp

Jakub Staszak kubastaszak at gmail.com
Wed Oct 31 18:10:43 PDT 2012


Author: kuba
Date: Wed Oct 31 20:10:43 2012
New Revision: 167196

URL: http://llvm.org/viewvc/llvm-project?rev=167196&view=rev
Log:
Don't insert and erase load instruction. Simply create (new) and delete it.

Modified:
    llvm/trunk/lib/Transforms/Scalar/SROA.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=167196&r1=167195&r2=167196&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Wed Oct 31 20:10:43 2012
@@ -2521,12 +2521,12 @@
       // the computed value, and then replace the placeholder with LI, leaving
       // LI only used for this computation.
       Value *Placeholder
-        = IRB.CreateLoad(UndefValue::get(LI.getType()->getPointerTo()));
+        = new LoadInst(UndefValue::get(LI.getType()->getPointerTo()));
       V = insertInteger(TD, IRB, Placeholder, V, BeginOffset,
                         getName(".insert"));
       LI.replaceAllUsesWith(V);
       Placeholder->replaceAllUsesWith(&LI);
-      cast<Instruction>(Placeholder)->eraseFromParent();
+      delete Placeholder;
       if (Pass.DeadSplitInsts.insert(&LI))
         Pass.DeadInsts.push_back(&LI);
       DEBUG(dbgs() << "          to: " << *V << "\n");





More information about the llvm-commits mailing list