[llvm] [InstCombine] Skip redundant demanded element queries in insert chains (PR #205948)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 28 02:31:11 PDT 2026


================
@@ -1607,6 +1665,11 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
     break;
   }
   case Instruction::InsertElement: {
+    auto *IE = cast<InsertElementInst>(I);
+    if (Depth == 0 && DemandedElts.isAllOnes() &&
----------------
dtcxzyw wrote:

I'd prefer to move the check into `visitInsertElementInst`:
https://github.com/llvm/llvm-project/blob/92f01b267efe262a096baa433665c169cd53ff2c/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp#L1836-L1846

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


More information about the llvm-commits mailing list