Commit 5cdb757
authored
[Delinearization] Remove
Delinearization has its own `isKnownNonNegative` function, which wraps
`ScalarEvolution::isKnownNonNegative` and adds additional logic. The
additional logic is that, for a pointer addrec `{a,+,b}`, if the pointer
has `inbounds` and both `a` and `b` are known to be non-negative, then
the addrec is also known non-negative (i.e., it doesn't wrap). This
reasoning is incorrect. If the GEP and/or load/store using the pointer
are not unconditionally executed in the loop, then the addrec can still
wrap. Even though no actual example has been found where this causes a
miscompilation (probably because the subsequent checks fail so the
validation also fails), simply replacing it with
`ScalarEvolution::isKnownNonNegative` is safer, especially it doesn't
cause any regressions in the existing tests.
Resolve #169811isKnownNonNegative (#171817)1 parent 366f3ac commit 5cdb757
File tree
3 files changed
+9
-35
lines changed- llvm
- include/llvm/Analysis
- lib/Analysis
3 files changed
+9
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
| 146 | + | |
148 | 147 | | |
149 | 148 | | |
150 | | - | |
151 | | - | |
| 149 | + | |
152 | 150 | | |
153 | 151 | | |
154 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | 669 | | |
690 | 670 | | |
691 | 671 | | |
| |||
755 | 735 | | |
756 | 736 | | |
757 | 737 | | |
758 | | - | |
759 | | - | |
| 738 | + | |
760 | 739 | | |
761 | 740 | | |
762 | 741 | | |
| |||
780 | 759 | | |
781 | 760 | | |
782 | 761 | | |
783 | | - | |
| 762 | + | |
784 | 763 | | |
785 | 764 | | |
786 | 765 | | |
| |||
943 | 922 | | |
944 | 923 | | |
945 | 924 | | |
946 | | - | |
947 | | - | |
| 925 | + | |
948 | 926 | | |
949 | 927 | | |
950 | 928 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3287 | 3287 | | |
3288 | 3288 | | |
3289 | 3289 | | |
3290 | | - | |
3291 | | - | |
| 3290 | + | |
| 3291 | + | |
3292 | 3292 | | |
3293 | 3293 | | |
3294 | 3294 | | |
| |||
3307 | 3307 | | |
3308 | 3308 | | |
3309 | 3309 | | |
3310 | | - | |
3311 | | - | |
3312 | 3310 | | |
3313 | 3311 | | |
3314 | 3312 | | |
| |||
3353 | 3351 | | |
3354 | 3352 | | |
3355 | 3353 | | |
3356 | | - | |
3357 | | - | |
| 3354 | + | |
| 3355 | + | |
3358 | 3356 | | |
3359 | 3357 | | |
3360 | 3358 | | |
| |||
0 commit comments