[llvm] [VectorCombine] Remove dead node immediately in VectorCombine (PR #149047)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 15 02:55:30 PDT 2025


================
@@ -563,52 +576,41 @@ static ExtractElementInst *translateExtract(ExtractElementInst *ExtElt,
 
   Value *Shuf = createShiftShuffle(X, cast<ConstantInt>(C)->getZExtValue(),
                                    NewIndex, Builder);
-  return dyn_cast<ExtractElementInst>(
-      Builder.CreateExtractElement(Shuf, NewIndex));
+  return Shuf;
 }
 
 /// Try to reduce extract element costs by converting scalar compares to vector
 /// compares followed by extract.
 /// cmp (ext0 V0, C), (ext1 V1, C)
-void VectorCombine::foldExtExtCmp(ExtractElementInst *Ext0,
-                                  ExtractElementInst *Ext1, Instruction &I) {
+Value *VectorCombine::foldExtExtCmp(Value *V0, Value *V1, Value *ExtIndex,
----------------
RKSimon wrote:

(pedantic) update the comment to use ExtIndex (or another common varname)

https://github.com/llvm/llvm-project/pull/149047


More information about the llvm-commits mailing list