Souper says:
; Function: fn1
%0:i32 = var
%1:i32 = sdiv 1:i32, %0
%2:i1 = slt 1:i32, %1
cand %2 0:i1
COMMAND: /home/regehr/souper/build/souper -stp-path=/usr/local/bin/stp reduce_587/foo.bc
LLVM says:
define i32 @fn1() #0 {
entry:
%0 = load i32* @a, align 4, !tbaa !1
%div = sdiv i32 1, %0
%cmp = icmp sgt i32 %div, 1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -c -w -emit-llvm -O3 reduce_587/foo.c -o reduce_587/foo.bc
C source code:
int a;
int fn1() { return 1 < 1 / a; }
x86-64 from LLVM:
fn1: # @fn1
movl $1, %eax
xorl %edx, %edx
idivl a(%rip)
cmpl $1, %eax
setg %al
movzbl %al, %eax
retq
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -w -O3 reduce_587/foo.c -S -o -
x86-64 from GCC:
fn1:
xorl %eax, %eax
ret
COMMAND: gcc -w -O3 reduce_587/foo.c -S -o -