Commit 81b1065
committed
[AArch64] Fix comparison peephole opt with non-0/1 immediate (PR51476)
This is a non-intrusive fix for
https://bugs.llvm.org/show_bug.cgi?id=51476 intended for backport
to the 13.x release branch. It expands on the current hack by
distinguishing between CmpValue of 0, 1 and 2, where 0 and 1 have
the obvious meaning and 2 means "anything else". The new optimization
from D98564 should only be performed for CmpValue of 0 or 1.
For main, I think we should switch the analyzeCompare() and
optimizeCompare() APIs to use int64_t instead of int, which is in
line with MachineOperand's notion of an immediate, and avoids this
problem altogether.
Differential Revision: https://reviews.llvm.org/D1080761 parent 49de607 commit 81b1065
File tree
3 files changed
+93
-15
lines changed- llvm
- lib/Target/AArch64
- test/CodeGen/AArch64
3 files changed
+93
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1120 | 1120 | | |
1121 | 1121 | | |
1122 | 1122 | | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
1123 | 1133 | | |
1124 | 1134 | | |
1125 | 1135 | | |
| |||
1155 | 1165 | | |
1156 | 1166 | | |
1157 | 1167 | | |
1158 | | - | |
1159 | | - | |
| 1168 | + | |
1160 | 1169 | | |
1161 | 1170 | | |
1162 | 1171 | | |
| |||
1165 | 1174 | | |
1166 | 1175 | | |
1167 | 1176 | | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
1171 | | - | |
1172 | | - | |
1173 | | - | |
| 1177 | + | |
1174 | 1178 | | |
1175 | | - | |
| 1179 | + | |
1176 | 1180 | | |
1177 | 1181 | | |
1178 | 1182 | | |
| |||
1462 | 1466 | | |
1463 | 1467 | | |
1464 | 1468 | | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
1469 | 1472 | | |
1470 | 1473 | | |
1471 | 1474 | | |
1472 | 1475 | | |
1473 | 1476 | | |
1474 | 1477 | | |
1475 | 1478 | | |
1476 | | - | |
| 1479 | + | |
1477 | 1480 | | |
1478 | | - | |
| 1481 | + | |
| 1482 | + | |
1479 | 1483 | | |
1480 | 1484 | | |
1481 | 1485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments