[llvm] 6c40569 - [VPlan] Get type from start value for VPWidenIntOrFpInduction (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu May 15 13:31:19 PDT 2025


Author: Florian Hahn
Date: 2025-05-15T21:31:04+01:00
New Revision: 6c405694d134f708c064df37bf4ac79a84374c58

URL: https://github.com/llvm/llvm-project/commit/6c405694d134f708c064df37bf4ac79a84374c58
DIFF: https://github.com/llvm/llvm-project/commit/6c405694d134f708c064df37bf4ac79a84374c58.diff

LOG: [VPlan] Get type from start value for VPWidenIntOrFpInduction (NFC).

NFC for now but this can cause verification failures in the future,
since after bf5627c85e697 wide induction may be narrowed. By using the
type from the start value, we will always return the correct type.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 5fd7a369bf735..5bc012c9783e0 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -2004,7 +2004,8 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe {
 
   /// Returns the scalar type of the induction.
   Type *getScalarType() const {
-    return Trunc ? Trunc->getType() : getPHINode()->getType();
+    return Trunc ? Trunc->getType()
+                 : getStartValue()->getLiveInIRValue()->getType();
   }
 
   /// Returns the VPValue representing the value of this induction at


        


More information about the llvm-commits mailing list