@@ -1860,6 +1860,9 @@ class VPWidenInductionRecipe : public VPHeaderPHIRecipe {
1860
1860
class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe {
1861
1861
TruncInst *Trunc;
1862
1862
1863
+ // If this recipe is unrolled it will have 2 additional operands.
1864
+ bool isUnrolled () const { return getNumOperands () == 5 ; }
1865
+
1863
1866
public:
1864
1867
VPWidenIntOrFpInductionRecipe (PHINode *IV, VPValue *Start, VPValue *Step,
1865
1868
VPValue *VF, const InductionDescriptor &IndDesc,
@@ -1908,9 +1911,9 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe {
1908
1911
const VPValue *getVFValue () const { return getOperand (2 ); }
1909
1912
1910
1913
VPValue *getSplatVFValue () {
1911
- // If the recipe has been unrolled (4 operands), return the VPValue for the
1912
- // induction increment.
1913
- return getNumOperands () == 5 ? getOperand (3 ) : nullptr ;
1914
+ // If the recipe has been unrolled return the VPValue for the induction
1915
+ // increment.
1916
+ return isUnrolled () ? getOperand (getNumOperands () - 2 ) : nullptr ;
1914
1917
}
1915
1918
1916
1919
// / Returns the first defined value as TruncInst, if it is one or nullptr
@@ -1932,7 +1935,7 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe {
1932
1935
// / the last unrolled part, if it exists. Returns itself if unrolling did not
1933
1936
// / take place.
1934
1937
VPValue *getLastUnrolledPartOperand () {
1935
- return getNumOperands () == 5 ? getOperand (4 ) : this ;
1938
+ return isUnrolled () ? getOperand (getNumOperands () - 1 ) : this ;
1936
1939
}
1937
1940
};
1938
1941
0 commit comments