Open
Description
Not of trunc nuw iN ... to i1
equalities can be propagated.
For example, store i8 %v, ptr %p, align 8
-> store i8 0, ptr %p, align 8
in
define i8 @src(ptr %p, i8 %v, i1 %cond) {
%trunc = trunc nuw i8 %v to i1
%not = xor i1 %trunc, true
%and = and i1 %not, %cond
br i1 %and, label %3, label %common.ret
common.ret:
ret i8 0
3:
store i8 %v, ptr %p, align 8
br label %common.ret
}
should be optimized to:
define i8 @src(ptr %p, i8 %v, i1 %cond) {
%trunc = trunc nuw i8 %v to i1
%not = xor i1 %trunc, true
%and = and i1 %not, %cond
br i1 %and, label %3, label %common.ret
common.ret:
ret i8 0
3:
store i8 0, ptr %p, align 8
br label %common.ret
}
Discussed in #143273