Commit 3bce613
[DAGCombiner] don't try to partially reduce add-with-overflow ops
This transform was added with D58874, but there were no tests for overflow ops.
We need to change this one way or another because it can crash as shown in:
https://llvm.org/PR51238
Note that if there are no uses of an overflow op's bool overflow result, we
reduce it to a regular math op, so we continue to fold that case either way.
If we have uses of both the math and the overflow bool, then we are likely
not saving anything by creating an independent sub instruction as seen in
the test diffs here.
This patch makes the behavior in SDAG consistent with what we do in
instcombine AFAICT.
Differential Revision: https://reviews.llvm.org/D106983
(cherry picked from commit fa6b2c9)1 parent e6ca023 commit 3bce613
File tree
3 files changed
+35
-22
lines changed- llvm
- lib/CodeGen/SelectionDAG
- test/CodeGen
- AArch64
- X86
3 files changed
+35
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2439 | 2439 | | |
2440 | 2440 | | |
2441 | 2441 | | |
2442 | | - | |
2443 | | - | |
2444 | | - | |
| 2442 | + | |
2445 | 2443 | | |
2446 | 2444 | | |
2447 | 2445 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
238 | 237 | | |
239 | 238 | | |
240 | 239 | | |
| |||
253 | 252 | | |
254 | 253 | | |
255 | 254 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
260 | 258 | | |
261 | 259 | | |
262 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | | - | |
385 | | - | |
386 | | - | |
| 384 | + | |
| 385 | + | |
387 | 386 | | |
388 | | - | |
389 | | - | |
| 387 | + | |
| 388 | + | |
390 | 389 | | |
391 | 390 | | |
392 | 391 | | |
| |||
402 | 401 | | |
403 | 402 | | |
404 | 403 | | |
405 | | - | |
406 | | - | |
407 | | - | |
| 404 | + | |
| 405 | + | |
408 | 406 | | |
409 | | - | |
410 | | - | |
| 407 | + | |
| 408 | + | |
411 | 409 | | |
412 | 410 | | |
413 | 411 | | |
| |||
417 | 415 | | |
418 | 416 | | |
419 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
0 commit comments