https://bugs.llvm.org/show_bug.cgi?id=42391
Bug ID: 42391
Summary: InstCombine: shift amount reassociation
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/S9Zn-y
https://rise4fun.com/Alive/plLm
int bad2(unsigned diff, unsigned len1, unsigned len2) {
return ((diff >> (32-len1)) >> (len1 - 1));
}
int good2(unsigned diff, unsigned len1, unsigned len2) {
return diff >> ((32-len1)+(len1-1));
}
Name: dd
Pre: C > 0 ; signed positive
%4 = sub i32 32, %1
%5 = lshr i32 %0, %4
%6 = sub i32 %1, C
%r = lshr i32 %5, %6
=>
%z4 = sub i32 32, C
%r = lshr i32 %0, %z4
--
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