[llvm] 3b8f442 - [InstCombine] Fix worklist management for multi-use demanded element fold

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 05:54:41 PDT 2023


Author: Nikita Popov
Date: 2023-05-17T14:54:27+02:00
New Revision: 3b8f4422894bc7622c8bb42ae62adbc24c662015

URL: https://github.com/llvm/llvm-project/commit/3b8f4422894bc7622c8bb42ae62adbc24c662015
DIFF: https://github.com/llvm/llvm-project/commit/3b8f4422894bc7622c8bb42ae62adbc24c662015.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

Removed: 
    


################################################################################
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;
             }


        


More information about the llvm-commits mailing list