Commit faa607a
[InstCombine] Fix profile metadata when folding implied conditionals (llvm#170756)
\llvm#163412 touched this last and directly propagated the profile
information. This was not correct for the motivating example:
%a = icmp eq i32 %z, 0
%b = icmp eq i32 %z, 1
%v2 = select i1 %b, i1 true, i1 %pred, !prof !18
%v3 = and i1 %a, %v2
to
%a = icmp eq i32 %z, 0
%v3 = select i1 %a, i1 %pred, i1 false
z == 1 does not imply that z == 0 for i8. In general for the and case,
we need a => b, which means that b must be equivalent or more
restrictive than a, which means we cannot propagate profile information
without additional information on the value distribution of z. For the
or case we need !a => b. We again cannot derive profile information for
a/!a without additional value distribution information.1 parent 7056a90 commit faa607a
File tree
2 files changed
+4
-8
lines changed- llvm
- lib/Transforms/InstCombine
- test/Transforms/InstCombine
2 files changed
+4
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3067 | 3067 | | |
3068 | 3068 | | |
3069 | 3069 | | |
3070 | | - | |
3071 | | - | |
3072 | | - | |
3073 | | - | |
3074 | | - | |
| 3070 | + | |
| 3071 | + | |
3075 | 3072 | | |
3076 | | - | |
3077 | | - | |
| 3073 | + | |
3078 | 3074 | | |
3079 | 3075 | | |
3080 | 3076 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
0 commit comments