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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 03:43:09 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);
----------------
david-arm wrote:

Without seeing the test before this patch I can't really tell what effect it had. Could you have a separate commit for the test so we can see the change?

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


More information about the llvm-commits mailing list