Commit 830cf36
authored
[LVI][ValueTracking] Take UB-implying attributes into account in
Closes llvm#137582.
In the original case, LVI uses the edge information in `%entry ->
%if.end` to get a more precise result. However, since the call to `smin`
has an `noundef` return attribute, an immediate UB will be triggered
after optimization.
Currently, `isSafeToSpeculativelyExecuteWithOpcode(%min)` returns true
because
llvm@6a288c1
only checks whether the function is speculatable. However, it is not
enough in this case.
This patch takes UB-implying attributes into account if
`IgnoreUBImplyingAttrs` is set to false. If it is set to true, the
caller is responsible for correctly propagating UB-implying attributes.isSafeToSpeculativelyExecute (llvm#137604)1 parent 4075a36 commit 830cf36
File tree
6 files changed
+86
-19
lines changed- llvm
- include/llvm
- Analysis
- IR
- lib
- Analysis
- IR
6 files changed
+86
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
542 | 548 | | |
543 | 549 | | |
544 | 550 | | |
545 | 551 | | |
546 | 552 | | |
547 | 553 | | |
548 | 554 | | |
549 | | - | |
| 555 | + | |
| 556 | + | |
550 | 557 | | |
551 | 558 | | |
552 | 559 | | |
553 | 560 | | |
554 | 561 | | |
555 | 562 | | |
556 | | - | |
| 563 | + | |
| 564 | + | |
557 | 565 | | |
558 | | - | |
| 566 | + | |
| 567 | + | |
559 | 568 | | |
560 | 569 | | |
561 | 570 | | |
562 | 571 | | |
563 | | - | |
564 | | - | |
| 572 | + | |
| 573 | + | |
565 | 574 | | |
566 | | - | |
| 575 | + | |
| 576 | + | |
567 | 577 | | |
568 | 578 | | |
569 | 579 | | |
| |||
586 | 596 | | |
587 | 597 | | |
588 | 598 | | |
589 | | - | |
| 599 | + | |
| 600 | + | |
590 | 601 | | |
591 | 602 | | |
592 | 603 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
588 | 592 | | |
589 | 593 | | |
590 | 594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1701 | 1701 | | |
1702 | 1702 | | |
1703 | 1703 | | |
1704 | | - | |
| 1704 | + | |
| 1705 | + | |
1705 | 1706 | | |
1706 | 1707 | | |
1707 | 1708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7201 | 7201 | | |
7202 | 7202 | | |
7203 | 7203 | | |
7204 | | - | |
7205 | | - | |
7206 | | - | |
7207 | | - | |
7208 | | - | |
7209 | | - | |
| 7204 | + | |
| 7205 | + | |
| 7206 | + | |
| 7207 | + | |
7210 | 7208 | | |
7211 | | - | |
| 7209 | + | |
| 7210 | + | |
7212 | 7211 | | |
7213 | 7212 | | |
7214 | 7213 | | |
7215 | 7214 | | |
7216 | 7215 | | |
7217 | | - | |
| 7216 | + | |
7218 | 7217 | | |
7219 | 7218 | | |
7220 | 7219 | | |
| |||
7287 | 7286 | | |
7288 | 7287 | | |
7289 | 7288 | | |
7290 | | - | |
| 7289 | + | |
| 7290 | + | |
| 7291 | + | |
| 7292 | + | |
| 7293 | + | |
7291 | 7294 | | |
7292 | 7295 | | |
7293 | 7296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
536 | | - | |
| 535 | + | |
| 536 | + | |
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
| |||
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
557 | 571 | | |
558 | 572 | | |
559 | 573 | | |
| |||
Lines changed: 34 additions & 0 deletions
| 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 | + | |
0 commit comments