diff options
| author | Bob Wilson <bob.wilson@apple.com> | 2009-12-08 18:22:03 +0000 |
|---|---|---|
| committer | Bob Wilson <bob.wilson@apple.com> | 2009-12-08 18:22:03 +0000 |
| commit | 2029ea04f948579d7facf0e30630eb26f1c88ad7 (patch) | |
| tree | 88c50e486d9153061b05955bf2472edc91e5a9f9 /llvm/lib | |
| parent | 049bdcac498f059d721f3dc035525b8d7cbe2fbd (diff) | |
| download | bcm5719-llvm-2029ea04f948579d7facf0e30630eb26f1c88ad7.tar.gz bcm5719-llvm-2029ea04f948579d7facf0e30630eb26f1c88ad7.zip | |
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.
llvm-svn: 90864
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index b0008a446bb..abd4a77d343 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -769,6 +769,10 @@ void SROA::RewriteMemIntrinUserOfAlloca(MemIntrinsic *MI, Instruction *BCInst, 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 @@ void SROA::RewriteMemIntrinUserOfAlloca(MemIntrinsic *MI, Instruction *BCInst, } } MI->eraseFromParent(); + if (PossiblyDead) + RecursivelyDeleteTriviallyDeadInstructions(PossiblyDead); } /// RewriteStoreUserOfWholeAlloca - We found a store of an integer that |

