Commit 4147cd2
authored
[WebAssembly][FastISel] Emit signed loads for sext of i8/i16/i32 (llvm#182767)
FastISel currently defaults to unsigned loads for i8/i16/i32 types,
leaving any sign-extension to be handled by a separate instruction. This
patch optimizes this by folding the SExtInst into the LoadInst, directly
emitting a signed load (e.g., i32.load8_s).
When a load has a single SExtInst use, selectLoad emits a signed load
and safely removes the redundantly emitted SExtInst.
Fixed: llvm#1807831 parent f71bd1c commit 4147cd2
3 files changed
Lines changed: 55 additions & 14 deletions
File tree
- llvm
- lib/Target/WebAssembly
- test/CodeGen/WebAssembly
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
207 | 209 | | |
208 | 210 | | |
209 | 211 | | |
| |||
1267 | 1269 | | |
1268 | 1270 | | |
1269 | 1271 | | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
1270 | 1318 | | |
1271 | 1319 | | |
1272 | 1320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | | - | |
59 | | - | |
| 57 | + | |
60 | 58 | | |
61 | 59 | | |
62 | 60 | | |
| |||
150 | 148 | | |
151 | 149 | | |
152 | 150 | | |
153 | | - | |
154 | | - | |
| 151 | + | |
155 | 152 | | |
156 | 153 | | |
157 | 154 | | |
| |||
179 | 176 | | |
180 | 177 | | |
181 | 178 | | |
182 | | - | |
183 | | - | |
| 179 | + | |
184 | 180 | | |
185 | 181 | | |
186 | 182 | | |
| |||
538 | 534 | | |
539 | 535 | | |
540 | 536 | | |
541 | | - | |
542 | | - | |
| 537 | + | |
543 | 538 | | |
544 | 539 | | |
545 | 540 | | |
| |||
564 | 559 | | |
565 | 560 | | |
566 | 561 | | |
567 | | - | |
568 | | - | |
| 562 | + | |
569 | 563 | | |
570 | 564 | | |
571 | 565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
| 124 | + | |
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
| |||
0 commit comments