Souper says:
; Function: fn1
%0:i32 = var
%1:i32 = or 5529:i32, %0
%2:i1 = var
%3:i32 = select %2, 0:i32, 4294967283:i32
%4:i1 = eq %1, %3
cand %4 0:i1
COMMAND: /home/regehr/souper/build/souper -stp-path=/usr/local/bin/stp reduce_435/foo.bc
LLVM says:
define void @fn1() #0 {
entry:
%0 = load i32* @a, align 4, !tbaa !1
%or = or i32 %0, 5529
%.b = load i1* @b, align 1
%add = select i1 %.b, i32 0, i32 -13
%tobool = icmp eq i32 %or, %add
br i1 %tobool, label %if.end, label %if.then
if.then: ; preds = %entry
store i1 true, i1* @b, align 1
br label %if.end
if.end: ; preds = %entry, %if.then
ret void
}
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -c -w -emit-llvm -O3 reduce_435/foo.c -o reduce_435/foo.bc
C source code:
int a;
static int b = 13;
void fn1() {
if ((a | 5529) + b)
b = 0;
}
x86-64 from LLVM:
fn1: # @fn1
movl $5529, %eax # imm = 0x1599
orl a(%rip), %eax
movb b(%rip), %cl
xorl %edx, %edx
testb %cl, %cl
movl $-13, %ecx
cmovnel %edx, %ecx
cmpl %ecx, %eax
je .LBB0_2
movb $1, b(%rip)
.LBB0_2: # %if.end
retq
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -w -O3 reduce_435/foo.c -S -o -
x86-64 from GCC:
fn1:
movl a(%rip), %eax
orl $5529, %eax
addl b(%rip), %eax
testl %eax, %eax
je .L1
movl $0, b(%rip)
.L1:
rep ret
b:
COMMAND: gcc -w -O3 reduce_435/foo.c -S -o -