https://bugs.llvm.org/show_bug.cgi?id=51286
Bug ID: 51286
Summary: Regression: Missed fold for x * 0
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: l...@rifkin.dev
CC: llvm-bugs@lists.llvm.org
Clang trunk is not generating optimal code for a (very poor) multiplication
routine https://godbolt.org/z/GrjMhsTcv.
int mul(int x, int y) {
int p = 0;
while(x--) p += y;
return p;
}
Should compile to:
mul(int, int):
mov eax, edi
imul eax, esi
ret
And it does in clang 12 but not in clang trunk.
If I'm not mistaken it appears a select i1 (icmp eq i32 %x, 0), i32 0, i32 (mul
i32 %x, %y) -> mul i32 %x, %y fold is not firing.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs