When not useful bits, BitWidth becomes 0 and APInt will not be happy.
See https://llvm.org/bugs/show_bug.cgi?id=25571
We can just mark the operand as IMPLICIT_DEF is none bits of it is used.
Differential D14803
[AArch64] Fix a corner case in BitFeild select weimingz on Nov 18 2015, 6:32 PM. Authored by
Details When not useful bits, BitWidth becomes 0 and APInt will not be happy. See https://llvm.org/bugs/show_bug.cgi?id=25571 We can just mark the operand as IMPLICIT_DEF is none bits of it is used.
Diff Detail Event TimelineComment Actions This LGTM, Thanks!
Comment Actions Hi Weiming, I think your fix is correct, but if fixed differently it may lead to better code being generated. The reason isBitfieldDstMask ends up with a BitWidth of 0 is because isBitfieldInsertOpFromOr has computed that the Or node in question has 0 UsefulBits, which if I understand correctly, means it is dead and could be replaced with an UNDEF node, allowing the instructions feeding to potentially be removed.
Comment Actions This change looks good to me (but that's not too suprising, since it's pretty much the change I suggested). I would like to hear from Tim or James on whether they think this small added code complexity is worth it (as opposed to just going with the original fix). |
Comments should begin with an uppercase letter.