[llvm] [VPlan] Use VPTypeAnalysis to get the step type of widen pointer induction (PR #147925)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 04:13:20 PDT 2025


================
@@ -854,8 +854,8 @@ optimizeLatchExitInductionUser(VPlan &Plan, VPTypeAnalysis &TypeInfo,
   if (ScalarTy->isIntegerTy())
     return B.createNaryOp(Instruction::Sub, {EndValue, Step}, {}, "ind.escape");
   if (ScalarTy->isPointerTy()) {
-    auto *Zero = Plan.getOrAddLiveIn(
-        ConstantInt::get(Step->getLiveInIRValue()->getType(), 0));
+    Type *StepTy = TypeInfo.inferScalarType(Step);
----------------
fhahn wrote:

It will crash if Step isn't a live in.

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


More information about the llvm-commits mailing list