Commit 5b92713
authored
[ConstraintElim] Use cond from header as upper bound on IV in exit BB. (#94610)
For loops, we can use the condition in the loop header as upper bound on
the compared induction in the unique exit block, if it exists. This can
be done even if there are multiple in-loop edges to the unique exit
block, as any other exit may only exit earlier.
More generally, we could add the OR of all exit conditions to the exit,
but that's a possible future extension.
PR: #946101 parent e217f98 commit 5b92713
File tree
2 files changed
+19
-10
lines changed- llvm
- lib/Transforms/Scalar
- test/Transforms/ConstraintElimination
2 files changed
+19
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1032 | 1032 | | |
1033 | 1033 | | |
1034 | 1034 | | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
1035 | 1049 | | |
1036 | 1050 | | |
1037 | 1051 | | |
| |||
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
99 | 98 | | |
100 | 99 | | |
101 | 100 | | |
102 | | - | |
103 | | - | |
| 101 | + | |
104 | 102 | | |
105 | 103 | | |
106 | 104 | | |
| |||
341 | 339 | | |
342 | 340 | | |
343 | 341 | | |
344 | | - | |
345 | | - | |
| 342 | + | |
346 | 343 | | |
347 | 344 | | |
348 | 345 | | |
| |||
419 | 416 | | |
420 | 417 | | |
421 | 418 | | |
422 | | - | |
423 | | - | |
| 419 | + | |
424 | 420 | | |
425 | 421 | | |
426 | 422 | | |
| |||
545 | 541 | | |
546 | 542 | | |
547 | 543 | | |
548 | | - | |
549 | | - | |
| 544 | + | |
550 | 545 | | |
551 | 546 | | |
552 | 547 | | |
| |||
0 commit comments