[SROA] Rather than copying the logic for building a name prefix into the
authorChandler Carruth <chandlerc@gmail.com>
Tue, 25 Feb 2014 11:12:04 +0000 (11:12 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 25 Feb 2014 11:12:04 +0000 (11:12 +0000)
PHI-pointer builder, just copy the builder and clobber the obvious
fields.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202136 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SROA.cpp

index 66da6c6ee0d2c28b3c1a256cdd82b15f47d598ab..a102212b96cd26b418d2515cdf64f6a78f8ce92f 100644 (file)
@@ -2649,9 +2649,9 @@ private:
     // as local as possible to the PHI. To do that, we re-use the location of
     // the old pointer, which necessarily must be in the right position to
     // dominate the PHI.
-    IRBuilderTy PtrBuilder(OldPtr);
-    PtrBuilder.SetNamePrefix(Twine(NewAI.getName()) + "." + Twine(BeginOffset) +
-                             ".");
+    IRBuilderTy PtrBuilder(IRB);
+    PtrBuilder.SetInsertPoint(OldPtr);
+    PtrBuilder.SetCurrentDebugLocation(OldPtr->getDebugLoc());
 
     Value *NewPtr =
         getAdjustedAllocaPtr(PtrBuilder, BeginOffset, OldPtr->getType());