[llvm-bugs] [Bug 44802] New: InstCombine unsafely drops zero extensions when combining shifts
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 5 09:22:38 PST 2020
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: unassignedbugs at nondot.org
Reporter: rspringer at google.com
CC: llvm-bugs at lists.llvm.org
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200205/dea63d9e/attachment.html>
More information about the llvm-bugs
mailing list