|
34 | 34 | // |
35 | 35 | // Note: (i' - i) * S is folded to the extent possible. |
36 | 36 | // |
37 | | -// For form Add and GEP, we can also rewrite a candidate in a simpler way |
| 37 | +// For Add and GEP forms, we can also rewrite a candidate in a simpler way |
38 | 38 | // with respect to other dominating candidates if their B or S are different |
39 | 39 | // but other parts are the same. For example, |
40 | 40 | // |
|
52 | 52 | // S1: X = &B[i * S] |
53 | 53 | // S2: Y = &B[i * S'] => X + i * (S' - S) |
54 | 54 | // |
55 | | -// PS: Stride delta write on form Mul is usually non-profitable, and Base delta |
56 | | -// write sometimes is profitable, so we do not support them on form Mul. |
| 55 | +// PS: Stride delta rewrite on Mul form is usually non-profitable, and Base |
| 56 | +// delta rewrite sometimes is profitable, so we do not support them on Mul. |
57 | 57 | // |
58 | 58 | // This rewriting is in general a good idea. The code patterns we focus on |
59 | 59 | // usually come from loop unrolling, so the delta is likely the same |
@@ -1124,8 +1124,9 @@ Value *StraightLineStrengthReduce::emitBump(const Candidate &Basis, |
1124 | 1124 | // IndexDelta |
1125 | 1125 | // X = B + i * S |
1126 | 1126 | // Y = B + i` * S |
1127 | | - // = B + (i' - i) * S |
1128 | | - // = X + Delta * S |
| 1127 | + // = B + (i + IndexDelta) * S |
| 1128 | + // = B + i * S + IndexDelta * S |
| 1129 | + // = X + IndexDelta * S |
1129 | 1130 | // Bump = (i' - i) * S |
1130 | 1131 |
|
1131 | 1132 | // If Delta is 0, C is a fully redundant of C.Basis, |
@@ -1154,15 +1155,15 @@ Value *StraightLineStrengthReduce::emitBump(const Candidate &Basis, |
1154 | 1155 | // StrideDelta |
1155 | 1156 | // X = B + i * S |
1156 | 1157 | // Y = B + i * S' |
1157 | | - // = B + i * (S + Delta) |
1158 | | - // = B + i * S + i * Delta |
| 1158 | + // = B + i * (S + StrideDelta) |
| 1159 | + // = B + i * S + i * StrideDelta |
1159 | 1160 | // = X + i * StrideDelta |
1160 | 1161 | // Bump = i * (S' - S) |
1161 | 1162 | // |
1162 | 1163 | // BaseDelta |
1163 | 1164 | // X = B + i * S |
1164 | 1165 | // Y = B' + i * S |
1165 | | - // = (B + Delta) + i * S |
| 1166 | + // = (B + BaseDelta) + i * S |
1166 | 1167 | // = X + BaseDelta |
1167 | 1168 | // Bump = (B' - B). |
1168 | 1169 | Value *Bump = C.Delta; |
|
0 commit comments