[llvm-commits] [llvm] r90864 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp

Bob Wilson bob.wilson at apple.com
Tue Dec 8 10:22:04 PST 2009


Author: bwilson
Date: Tue Dec  8 12:22:03 2009
New Revision: 90864

URL: http://llvm.org/viewvc/llvm-project?rev=90864&view=rev
Log:
Clean up dead operands left around after SROA replaces a mem intrinsic.
I'm not aware that this does anything significant on its own, but it's
needed for another patch that I'm working on.

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

Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=90864&r1=90863&r2=90864&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Dec  8 12:22:03 2009
@@ -769,6 +769,10 @@
       OtherPtr = MTI->getRawDest();
     }
   }
+
+  // Keep track of the other intrinsic argument, so it can be removed if it
+  // is dead when the intrinsic is replaced.
+  Value *PossiblyDead = OtherPtr;
   
   // If there is an other pointer, we want to convert it to the same pointer
   // type as AI has, so we can GEP through it safely.
@@ -922,6 +926,8 @@
     }
   }
   MI->eraseFromParent();
+  if (PossiblyDead)
+    RecursivelyDeleteTriviallyDeadInstructions(PossiblyDead);
 }
 
 /// RewriteStoreUserOfWholeAlloca - We found a store of an integer that





More information about the llvm-commits mailing list