Commit 05a8a81
committed
[LoopInterchange] Update the direction of undistributed loop to EQ
This commit enables loop-interchange for the case in #71519.
With the loop-interchange, the case can be vectorized.
for (int nl = 0; nl < 10000000/256; nl++) // Level 1
for (int i = 0; i < 256; ++i) // Level 2
for (int j = 1; j < 256; j++) // Level 3
aa[j][i] = aa[j - 1][i] + bb[j][i];
The case can't be interchanged without normalizaion.
normalizaion didn't occur because the direction of level 1 loop dependence
between aa[j][i] and aa[j - 1][i] is default value '*'.
By scanning SCEV form of the pointer of aa[j][i] and aa[j - 1][i], the pass
and determine the IV of loop 1(nl) didn't affect the value of aa[j][i] and
aa[j - 1][i]. And then updating the direction of loop 1 to '=' to enable
the normalization.1 parent 0cebb14 commit 05a8a81
File tree
2 files changed
+55
-6
lines changed- llvm
- lib/Transforms/Scalar
- test/Transforms/LoopInterchange
2 files changed
+55
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
120 | 155 | | |
121 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
122 | 159 | | |
123 | 160 | | |
124 | 161 | | |
| |||
189 | 226 | | |
190 | 227 | | |
191 | 228 | | |
192 | | - | |
| 229 | + | |
193 | 230 | | |
194 | 231 | | |
195 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
11 | 17 | | |
12 | 18 | | |
13 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
14 | 26 | | |
15 | 27 | | |
16 | 28 | | |
| |||
0 commit comments