[llvm] [InstCombine][foldPHIArgGEPIntoPHI] Early return for const vector index for gep inst. (PR #138661)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue May 6 02:55:55 PDT 2025


================
@@ -575,7 +575,9 @@ Instruction *InstCombinerImpl::foldPHIArgGEPIntoPHI(PHINode &PN) {
       // variable index could pessimize the path.  This also handles the case
       // for struct indices, which must always be constant.
       if (isa<ConstantInt>(FirstInst->getOperand(Op)) ||
-          isa<ConstantInt>(GEP->getOperand(Op)))
+          isa<ConstantInt>(GEP->getOperand(Op)) ||
+          isa<ConstantDataVector>(FirstInst->getOperand(Op)) ||
+          isa<ConstantDataVector>(GEP->getOperand(Op)))
----------------
nikic wrote:

Can you change these to just check isa<Constant> instead?

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


More information about the llvm-commits mailing list