summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2009-12-08 18:22:03 +0000
committerBob Wilson <bob.wilson@apple.com>2009-12-08 18:22:03 +0000
commit78c50b8cd68d266d4ed6f8eca443cf8142a01204 (patch)
treedca14bd12b812f26506e31b600f0d557a724bc9a /lib/Transforms/Scalar/ScalarReplAggregates.cpp
parenta3a60c6c49e457d825bddd1d300230c9d82cc17e (diff)
downloadllvm-78c50b8cd68d266d4ed6f8eca443cf8142a01204.tar.gz
llvm-78c50b8cd68d266d4ed6f8eca443cf8142a01204.tar.bz2
llvm-78c50b8cd68d266d4ed6f8eca443cf8142a01204.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/ScalarReplAggregates.cpp')
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index b0008a446b..abd4a77d34 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/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