https://bugs.llvm.org/show_bug.cgi?id=44802
Bug ID: 44802
Summary: InstCombine unsafely drops zero extensions when
combining shifts
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Reproducer: https://rise4fun.com/Alive/ne8y
In InstCombiner::reassociateShiftAmtsOfTwoSameDirectionShifts(), when
identifying two shifts to combine, it does so while ignoring any
zero-extensions of those values. In the problematic case above, the values were
both i1s zero-extended to i3s.
When their zero-extensions are dropped (taking them back to i1s) their sum
becomes an xor in SimplifyAddInst(), which causes the shift to basically
disappear (and to be dropped in a later pass).
I'm not familiar with the history of this code, particularly why the zero
extensions are ignored, but changing the code to leave them in place does fix
the issue.
--
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