From 3b8f4422894bc7622c8bb42ae62adbc24c662015 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 17 May 2023 14:31:21 +0200 Subject: [PATCH] [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. --- llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index f077f6f..7ffa30b 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; } -- 2.7.4