https://bugs.llvm.org/show_bug.cgi?id=50420
Bug ID: 50420
Summary: code compiled with -fwrapv is faster than without
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: jmuizel...@mozilla.com
CC: llvm-bugs@lists.llvm.org
The following compiles to:
int f(int param) {
int result = 0;
for (int i=param; i < param + 16; i++) {
result += param;
}
return result;
}
f(int): # @f(int)
lea eax, [rdi + 15]
cmp edi, eax
cmovg eax, edi
sub eax, edi
add eax, 1
imul eax, edi
ret
with -fwrapv it becomes:
f(int): # @f(int)
mov ecx, edi
shl ecx, 4
xor eax, eax
cmp edi, 2147483632
cmovl eax, ecx
ret
with gcc it becomes:
f(int):
mov eax, edi
sal eax, 4
ret
icc and msvc compile to something similar to gcc
--
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