Open
2 of 5 issues completedDescription
Bugzilla Link | 49930 |
Version | trunk |
OS | Windows NT |
Depends On | #7145 #40657 #49175 #43481 #50630 |
CC | @davidbolvansky,@aqjune,@LebedevRI,@nunoplopes,@rotateright |
Extended Description
Now that we have the freeze instruction (and we really want to get rid of undef), we should be more willing to perform folds that introduce freeze.
Part of this is a general apprehension about using freeze, and also we need to decide how freeze counts in the 'is this simpler or not' metric that we use for InstCombine combine rules.
For example, https://reviews.llvm.org/D100211 [Bug #44136], proposed the fold:
define i1 @src(i8 %a, i8 %b) {
%n = xor i8 %a, -1
%o = and i8 %n, %b
%c = icmp eq i8 %o, 0
ret i1 %c
}
define i1 @tgt(i8 %a, i8 %b) {
%aa = freeze i8 %a
%o = or i8 %aa, %b
%c = icmp eq i8 %o, %aa
ret i1 %c
}
The freeze is necessary for the fold to be valid, but means we don't reduce the instruction count (but does freeze count as an instruction in the same way?). And some were worried about freeze preventing later folds from occurring.