https://bugs.llvm.org/show_bug.cgi?id=35907
Bug ID: 35907
Summary: Overeager side effect propagation generates suboptimal
backend code
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: d...@znu.io
CC: llvm-bugs@lists.llvm.org
Consider the following two functions:
int64_t test_signed( int64_t arg) { return (arg >> 4) & -16; }
uint64_t test_unsigned(uint64_t arg) { return (arg >> 4) & -16; }
They should generate the same "AND" instruction in the backend, but due to
intermediate side effect propagation, the unsigned version generates:
%3 = and i64 %2, 1152921504606846960
Rather than:
%3 = and i64 %2, -16
This leads to suboptimal code on x86 and probably other architectures due to
how immediate values are encoded into instructions via sign extension.
As a naive observer, it seems to me that this side effect propagation should
abort of the "sign" of the unsigned value changes. This will lead to better
real world code gen in the backend.
--
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