https://bugs.llvm.org/show_bug.cgi?id=36304
Bug ID: 36304
Summary: [Regression] sub nsw i32 %x, -1 gets transformed into
add i32 %0, 2147483647 illegally
Product: new-bugs
Version: 6.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedb...@nondot.org
Reporter: arpha...@gmail.com
CC: llvm-bugs@lists.llvm.org
LLVM transforms the 'sub nsw i32 %x, -1' instruction into 'add i32 %0,
2147483647' illegally.
Reproducer:
$ cat test.cpp
typedef unsigned long size_t;
void *memcpy(void *__dst, const void *__src, size_t __n);
int Execute(int &minSize, char *Output, const char *Input) {
for (int d=0; d<64; ++d) {
for (int s=0; s<64; ++s) {
for (int n=0; n<3; ++n) {
size_t len = minSize + (n*0x11389737 & minSize-1);
memcpy(Output+d, Input+s, len);
}
}
}
return 0;
}
$ ~/u/b/bin/clang repr.cpp -S -Xclang -emit-llvm -O1 -o ir.ll
$ cat ir.ll
Bad pass: "Combine redundant instructions"
...
%mul = mul nuw nsw i32 %n.028, 288921399
%sub = add i32 %0, 2147483647
%and = and i32 %sub, %mul
...
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs