Skip to content

Commit 6be91c9

Browse files
committed
Improve comments
1 parent 58134c4 commit 6be91c9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
//
3535
// Note: (i' - i) * S is folded to the extent possible.
3636
//
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
3838
// with respect to other dominating candidates if their B or S are different
3939
// but other parts are the same. For example,
4040
//
@@ -52,8 +52,8 @@
5252
// S1: X = &B[i * S]
5353
// S2: Y = &B[i * S'] => X + i * (S' - S)
5454
//
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.
5757
//
5858
// This rewriting is in general a good idea. The code patterns we focus on
5959
// usually come from loop unrolling, so the delta is likely the same
@@ -1124,8 +1124,9 @@ Value *StraightLineStrengthReduce::emitBump(const Candidate &Basis,
11241124
// IndexDelta
11251125
// X = B + i * S
11261126
// 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
11291130
// Bump = (i' - i) * S
11301131

11311132
// If Delta is 0, C is a fully redundant of C.Basis,
@@ -1154,15 +1155,15 @@ Value *StraightLineStrengthReduce::emitBump(const Candidate &Basis,
11541155
// StrideDelta
11551156
// X = B + i * S
11561157
// 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
11591160
// = X + i * StrideDelta
11601161
// Bump = i * (S' - S)
11611162
//
11621163
// BaseDelta
11631164
// X = B + i * S
11641165
// Y = B' + i * S
1165-
// = (B + Delta) + i * S
1166+
// = (B + BaseDelta) + i * S
11661167
// = X + BaseDelta
11671168
// Bump = (B' - B).
11681169
Value *Bump = C.Delta;

0 commit comments

Comments
 (0)