Commit f4bd307
Automerge: [NFC][SROA] Clean up rewritePartition type selection process (#169106)
This change reverts
llvm/llvm-project@2572512,
which landed on Aug 8, 2022. This change addressed the problem that if
you have IR that looks something like:
```
%alloca = alloca <4 x float>
store <4 x float> %data, ptr %alloca
%load = load half, ptr %alloca
```
`getCommonType` would return `<4 x float>` because the `load half` isn't
to the entire partition, so we skip the first `getTypePartition` check.
llvm/llvm-project@2572512
added a later check that sees that `<4 x float>` is not vector
promotable because of the `load half`, and then calls
`getTypePartition`, which changes the `sliceTy` to `< 8 x half>`, which
is vector promotable because the store can be changed to `store <8 x
half>`. So we set the `sliceTy` to `<8 x half>`, we can promote the
alloca, and everyone is happy.
This code became unnecessary after
llvm/llvm-project@529eafd,
which landed ~3 months later, which fixes the issue in a different way.
`isVectorPromotionViable` was already smart enough to try `<8 x half>`
as a type candidate because it sees the `load half`. However, this
candidate didn't work because it conflicts with `store <4 x float>`.
This commit added logic to try integer-ifying candidates if there is no
common type. So the `<8 x half>` candidate gets converted to `<8 x
i16>`, which works because we can convert the alloca to `alloca <8 x
i16>` and the load to `load i16`, allowing promotion.
After
llvm/llvm-project@529eafd,
the original commit is pointless. It tries to refine the `SliceTy`, but
if `isVectorPromotionViable` succeeds, it returns a new type to use and
we will ignore the `SliceTy`.
This change is my first patch to try to simplify the type selection
process in rewritePartition. I had some other ideas that I tried in
llvm/llvm-project#167771 and
llvm/llvm-project#168796, but they need
refinement.1 file changed
+25
-51
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2178 | 2178 | | |
2179 | 2179 | | |
2180 | 2180 | | |
2181 | | - | |
2182 | | - | |
2183 | | - | |
2184 | | - | |
2185 | | - | |
2186 | | - | |
2187 | | - | |
2188 | | - | |
2189 | | - | |
2190 | | - | |
2191 | | - | |
2192 | | - | |
2193 | | - | |
2194 | | - | |
2195 | | - | |
2196 | | - | |
2197 | | - | |
2198 | | - | |
2199 | | - | |
2200 | | - | |
2201 | | - | |
2202 | | - | |
2203 | | - | |
2204 | | - | |
2205 | | - | |
2206 | | - | |
2207 | | - | |
2208 | | - | |
2209 | | - | |
2210 | 2181 | | |
2211 | 2182 | | |
2212 | 2183 | | |
| |||
2291 | 2262 | | |
2292 | 2263 | | |
2293 | 2264 | | |
2294 | | - | |
2295 | | - | |
2296 | | - | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
2297 | 2269 | | |
2298 | | - | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
2299 | 2289 | | |
2300 | 2290 | | |
2301 | 2291 | | |
| |||
5205 | 5195 | | |
5206 | 5196 | | |
5207 | 5197 | | |
5208 | | - | |
5209 | 5198 | | |
5210 | 5199 | | |
5211 | 5200 | | |
| |||
5214 | 5203 | | |
5215 | 5204 | | |
5216 | 5205 | | |
5217 | | - | |
| 5206 | + | |
5218 | 5207 | | |
5219 | | - | |
5220 | | - | |
5221 | 5208 | | |
5222 | 5209 | | |
5223 | 5210 | | |
| |||
5227 | 5214 | | |
5228 | 5215 | | |
5229 | 5216 | | |
5230 | | - | |
| 5217 | + | |
5231 | 5218 | | |
5232 | | - | |
5233 | | - | |
5234 | 5219 | | |
5235 | 5220 | | |
5236 | 5221 | | |
5237 | 5222 | | |
5238 | 5223 | | |
5239 | 5224 | | |
5240 | | - | |
5241 | | - | |
5242 | | - | |
5243 | | - | |
5244 | | - | |
5245 | | - | |
5246 | | - | |
5247 | | - | |
5248 | | - | |
5249 | | - | |
5250 | | - | |
5251 | 5225 | | |
5252 | 5226 | | |
5253 | 5227 | | |
| |||
0 commit comments