Commit 1448249
Fix SROA incorrect vector element index for padded min precision types
SROA's getNaturalGEPRecursively used getTypeSizeInBits (primitive size)
for vector element offsets, but GEP offset calculation uses
getTypeAllocSize (padded size). With DXC's data layout (i16:32, f16:32),
this mismatch caused byte offset 4 (element 1) to map to vector index 2
instead of index 1 (4/2=2 vs 4/4=1). This led SROA to misplace or
eliminate stores to vector elements 1 and 2, producing incorrect code.
Fix: Use getTypeAllocSizeInBits consistently for vector element sizes in
getNaturalGEPRecursively, isVectorPromotionViable, and the
AllocaSliceRewriter constructor.
Co-authored-by: Copilot <[email protected]>1 parent b9ffe55 commit 1448249
1 file changed
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1671 | 1671 | | |
1672 | 1672 | | |
1673 | 1673 | | |
1674 | | - | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
1675 | 1679 | | |
1676 | 1680 | | |
1677 | 1681 | | |
| |||
2134 | 2138 | | |
2135 | 2139 | | |
2136 | 2140 | | |
2137 | | - | |
| 2141 | + | |
| 2142 | + | |
2138 | 2143 | | |
2139 | 2144 | | |
2140 | 2145 | | |
| |||
2492 | 2497 | | |
2493 | 2498 | | |
2494 | 2499 | | |
2495 | | - | |
| 2500 | + | |
| 2501 | + | |
2496 | 2502 | | |
2497 | 2503 | | |
2498 | 2504 | | |
2499 | 2505 | | |
2500 | | - | |
| 2506 | + | |
2501 | 2507 | | |
2502 | 2508 | | |
2503 | 2509 | | |
| |||
0 commit comments