Closed
Description
Bugzilla Link | 28238 |
Version | trunk |
OS | All |
CC | @manueljacob,@sanjoy |
Extended Description
Spinning this off from bug 27869 (and may have a different solution than bug 28221):
int f(int i) {
return (i == 0) & (i >> 31);
}
'i' can't be 0 and have a bit set, so this should return 0.
$ ./clang -O1 sneaky_icmp.c -S -o - -emit-llvm
define i32 @f(i32 %i) {
%cmp = icmp eq i32 %i, 0
%conv = zext i1 %cmp to i32
%shr = ashr i32 %i, 31
%and = and i32 %conv, %shr
ret i32 %and
}