summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-05-17 14:31:21 +0200
committerNikita Popov <npopov@redhat.com>2023-05-17 14:54:27 +0200
commit3b8f4422894bc7622c8bb42ae62adbc24c662015 (patch)
tree3b989c501dd146bcc9cbc6bcb07637fa9e1081b7
parentfbdd7856d54346747b574a558da7199cd2acdf4e (diff)
downloadllvm-3b8f4422894bc7622c8bb42ae62adbc24c662015.tar.gz
[InstCombine] Fix worklist management for multi-use demanded element fold
Add the old instruction to the worklist, so it can be DCEd in the same iteration.
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index f077f6f29030..7ffa30b54b5f 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -594,6 +594,7 @@ Instruction *InstCombinerImpl::visitExtractElementInst(ExtractElementInst &EI) {
SrcVec, DemandedElts, UndefElts, 0 /* Depth */,
true /* AllowMultipleUsers */)) {
if (V != SrcVec) {
+ Worklist.addValue(SrcVec);
SrcVec->replaceAllUsesWith(V);
return &EI;
}