Souper says:
; Function: fn1
%0:i32 = var
%1:i32 = or 1:i32, %0
%2:i1 = sle %0, %1
cand %2 1:i1
COMMAND: /home/regehr/souper/build/souper -stp-path=/usr/local/bin/stp reduce_141/foo.bc
LLVM says:
define void @fn1() #0 {
entry:
%0 = load i32* @b, align 4, !tbaa !1
%or = or i32 %0, 1
%cmp = icmp sge i32 %or, %0
%conv = zext i1 %cmp to i32
store i32 %conv, i32* @a, align 4, !tbaa !1
ret void
}
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -c -w -emit-llvm -O3 reduce_141/foo.c -o reduce_141/foo.bc
C source code:
int a, b;
void fn1() {
int c = (b | 0 == 0) >= b;
a = c;
}
x86-64 from LLVM:
fn1: # @fn1
movl b(%rip), %eax
movl %eax, %ecx
orl $1, %ecx
cmpl %eax, %ecx
setge %al
movzbl %al, %eax
movl %eax, a(%rip)
retq
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -w -O3 reduce_141/foo.c -S -o -
x86-64 from GCC:
fn1:
movl b(%rip), %eax
movl %eax, %edx
orl $1, %edx
cmpl %edx, %eax
setle %al
movzbl %al, %eax
movl %eax, a(%rip)
ret
COMMAND: gcc -w -O3 reduce_141/foo.c -S -o -