here's a function:
define i1 @f(i2 %0) {
%2 = call { i2, i1 } @llvm.smul.with.overflow.i2(i2 %0, i2 -2)
%3 = extractvalue { i2, i1 } %2, 1
ret i1 %3
}
declare { i2, i1 } @llvm.smul.with.overflow.i2(i2, i2)
clearly f(1) -> 0 because you can't get an overflow when multiplying by 1 but using this driver:
#include <stdio.h>
unsigned f(unsigned);
int main(void) {
printf("%u\n", f(1));
}
we get:
Johns-MacBook-Pro:~ regehr$ llc foo.ll
Johns-MacBook-Pro:~ regehr$ clang foo.c foo.s && ./a.out
1
Johns-MacBook-Pro:~ regehr$
cc @ornata @nunoplopes @ryan-berger @nbushehri @zhengyang92 @aqjune
here's a function:
clearly
f(1) -> 0because you can't get an overflow when multiplying by 1 but using this driver:we get:
cc @ornata @nunoplopes @ryan-berger @nbushehri @zhengyang92 @aqjune