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: unassignedb...@nondot.org
Reporter: hen...@gramner.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org
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
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs