Souper says:
; Function: fn1
%0:i32 = var
%1:i1 = ne 0:i32, %0
%2:i32 = zext %1
%3:i32 = or 12:i32, %2
%4:i32 = urem 4:i32, %3
%5:i1 = ne 0:i32, %4
cand %5 1:i1
COMMAND: /home/regehr/souper/build/souper -stp-path=/usr/local/bin/stp reduce_702/foo.bc
LLVM says:
define void @fn1() #0 {
entry:
%0 = load i32* @a, align 4, !tbaa !1
%tobool = icmp ne i32 %0, 0
%lor.ext = zext i1 %tobool to i32
%or = or i32 %lor.ext, 12
%rem = urem i32 4, %or
%tobool1 = icmp ne i32 %rem, 0
%lor.ext4 = zext i1 %tobool1 to i32
store i32 %lor.ext4, i32* @b, align 4, !tbaa !1
ret void
}
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -c -w -emit-llvm -O3 reduce_702/foo.c -o reduce_702/foo.bc
C source code:
int a, b;
void fn1() { b = 4 % ((a || 0) | 12) || 0; }
x86-64 from LLVM:
fn1: # @fn1
cmpl $0, a(%rip)
setne %al
movzbl %al, %ecx
orl $12, %ecx
movl $4, %eax
xorl %edx, %edx
divl %ecx
testl %edx, %edx
setne %al
movzbl %al, %eax
movl %eax, b(%rip)
retq
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -w -O3 reduce_702/foo.c -S -o -
x86-64 from GCC:
fn1:
movl $1, b(%rip)
ret
COMMAND: gcc -w -O3 reduce_702/foo.c -S -o -