https://bugs.llvm.org/show_bug.cgi?id=43033
Bug ID: 43033
Summary: Inlined functions are not optimized as well as the
same code copied in-line
Product: new-bugs
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Minimal sample code:
static inline int imin(int a, int b) {
return a < b ? a : b;
}
int fn1(int a, int b) {
if (a < b) __builtin_unreachable();
return imin(a, b);
}
int fn2(int a, int b) {
if (a < b) __builtin_unreachable();
return a < b ? a : b;
}
compiled with -O3 produces (Linux x86-64):
fn1:
mov eax, esi
cmp edi, esi
cmovle eax, edi
ret
fn2:
mov eax, esi
ret
Only in fn2 is the ternary operation correctly optimized away.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs