Commit 59eae91
authored
[ValueTracking] Don't use CondContext in dataflow analysis of phi nodes (#100316)
See the following case:
```
define i16 @pr100298() {
entry:
br label %for.inc
for.inc:
%indvar = phi i32 [ -15, %entry ], [ %mask, %for.inc ]
%add = add nsw i32 %indvar, 9
%mask = and i32 %add, 65535
%cmp1 = icmp ugt i32 %mask, 5
br i1 %cmp1, label %for.inc, label %for.end
for.end:
%conv = trunc i32 %add to i16
%cmp2 = icmp ugt i32 %mask, 3
%shl = shl nuw i16 %conv, 14
%res = select i1 %cmp2, i16 %conv, i16 %shl
ret i16 %res
}
```
When computing knownbits of `%shl` with `%cmp2=false`, we cannot use
this condition in the analysis of `%mask (%for.inc -> %for.inc)`.
Fixes #100298.1 parent 559be8e commit 59eae91
File tree
3 files changed
+56
-11
lines changed- llvm
- include/llvm/Analysis
- lib/Analysis
- test/Transforms/InstCombine
3 files changed
+56
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1435 | 1435 | | |
1436 | 1436 | | |
1437 | 1437 | | |
1438 | | - | |
| 1438 | + | |
1439 | 1439 | | |
1440 | 1440 | | |
1441 | 1441 | | |
| |||
1468 | 1468 | | |
1469 | 1469 | | |
1470 | 1470 | | |
1471 | | - | |
| 1471 | + | |
1472 | 1472 | | |
1473 | 1473 | | |
1474 | 1474 | | |
| |||
1546 | 1546 | | |
1547 | 1547 | | |
1548 | 1548 | | |
1549 | | - | |
| 1549 | + | |
1550 | 1550 | | |
1551 | 1551 | | |
1552 | 1552 | | |
| |||
2329 | 2329 | | |
2330 | 2330 | | |
2331 | 2331 | | |
2332 | | - | |
| 2332 | + | |
2333 | 2333 | | |
2334 | 2334 | | |
2335 | 2335 | | |
| |||
2943 | 2943 | | |
2944 | 2944 | | |
2945 | 2945 | | |
2946 | | - | |
| 2946 | + | |
2947 | 2947 | | |
2948 | 2948 | | |
2949 | 2949 | | |
| |||
3509 | 3509 | | |
3510 | 3510 | | |
3511 | 3511 | | |
3512 | | - | |
| 3512 | + | |
3513 | 3513 | | |
3514 | 3514 | | |
3515 | 3515 | | |
| |||
4001 | 4001 | | |
4002 | 4002 | | |
4003 | 4003 | | |
4004 | | - | |
| 4004 | + | |
4005 | 4005 | | |
4006 | 4006 | | |
4007 | 4007 | | |
| |||
5909 | 5909 | | |
5910 | 5910 | | |
5911 | 5911 | | |
5912 | | - | |
5913 | | - | |
5914 | | - | |
5915 | | - | |
| 5912 | + | |
| 5913 | + | |
| 5914 | + | |
| 5915 | + | |
5916 | 5916 | | |
5917 | 5917 | | |
5918 | 5918 | | |
| |||
| 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 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments