aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp
diff options
context:
space:
mode:
authorAlina Sbirlea <asbirlea@google.com>2020-01-23 14:21:08 -0800
committerAlina Sbirlea <asbirlea@google.com>2020-01-23 16:04:57 -0800
commit9e66c4ec127ef6e73f1bafe06fe3fba45d59feee (patch)
tree680cddd0ef06a249261dbd39c67b932b6b2765a3 /llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp
parent2af74e27ed7d0832cbdde9cb969aaca7a42e99f9 (diff)
downloadllvm-9e66c4ec127ef6e73f1bafe06fe3fba45d59feee.zip
llvm-9e66c4ec127ef6e73f1bafe06fe3fba45d59feee.tar.gz
llvm-9e66c4ec127ef6e73f1bafe06fe3fba45d59feee.tar.bz2
[Utils] Use WeakTrackingVH in vector used as scratch storage.
The utility method RecursivelyDeleteTriviallyDeadInstructions receives as input a vector of Instructions, where all inputs are valid instructions. This same vector is used as a scratch storage (per the header comment) to recursively delete instructions. If an instruction is added as an operand of multiple other instructions, it may be added twice, then deleted once, then the second reference in the vector is invalid. Switch to using a Vector<WeakTrackingVH>. This change facilitates a clean-up in LoopStrengthReduction.
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp b/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp
index 9012041..3153a87 100644
--- a/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp
@@ -68,7 +68,7 @@ static bool simplifyLoopInst(Loop &L, DominatorTree &DT, LoopInfo &LI,
// While simplifying we may discover dead code or cause code to become dead.
// Keep track of all such instructions and we will delete them at the end.
- SmallVector<Instruction *, 8> DeadInsts;
+ SmallVector<WeakTrackingVH, 8> DeadInsts;
// First we want to create an RPO traversal of the loop body. By processing in
// RPO we can ensure that definitions are processed prior to uses (for non PHI