[Mips] Use a proper boolean for the select condition in lowerShift*Parts (#241685)
lowerShiftLeftParts and lowerShiftRightParts used (and Shamt, VT.bits)
directly as the condition of ISD::SELECT. That value is 0 or VT.bits
(32, or 64 for i128 on MIPS64), not 0/1. Since MIPS uses
ZeroOrOneBooleanContent, DAG combines may treat the condition as a 0/1
value, e.g. folding select(c, 0, 1) into xor c, 1, which miscompiles
when the condition is 32. For example 0x1FFFFFFFF >> (b & 32) returned
0x2100000001 instead of 1 for b = 32 on MIPS32.
Compare the masked shift amount against zero with setcc ne to form the
select condition. The DOUBLE_SELECT_I/DOUBLE_SELECT_I64 path used for
pre-MIPS4/MIPS32 in lowerShiftRightParts branches on the value being
non-zero, so it keeps using the masked shift amount directly.
Fixes #235261
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[GlobalISel] Ignore debug uses in direct single-use combines (#237643)
Debug uses can block the lshr/trunc and insert-vector chain combines in
`CombinerHelper`, making ordinary Machine IR depend on debug
information.
This patch counts only non-debug uses and uses a non-debug iterator when
retrieving the insert-vector user. The regression tests cover both
combines and fail without the change.
These direct `MRI.hasOneUse()` checks are not covered by #237070, which
changes the `m_OneUse` matcher.
This issue was found through a source audit. AI assisted with the
analysis and development of the fix.
don't assume the new interface being patched is pair until the end.
care has to be taken to still release the requested ifnet reference,
regardless of whether it is a pair or not.
this should fix the 'pair(4): "patch" to a non-pair interface panics
(lo) or downs its link' problem reported by tom smyth on bugs@