https://bugs.llvm.org/show_bug.cgi?id=43594
Bug ID: 43594
Summary: [InstCombine] sign bit extract + trunc => icmp + zext?
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: lebedev...@gmail.com
CC: llvm-bugs@lists.llvm.org
https://godbolt.org/z/iSlCpW
For
int good(unsigned long input) {
return (signed long)input < 0;
}
we produce
define dso_local i32 @_Z4goodm(i64 %0) local_unnamed_addr #0 {
%2 = lshr i64 %0, 63
%3 = trunc i64 %2 to i32
ret i32 %3
}
Should this be instead:
define dso_local i32 @_Z4goodm(i64 %0) local_unnamed_addr #0 {
%2 = icmp slt i64 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
?
--
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