[llvm] Apply or-disjoint in SelectionDAG::isBaseWithConstantOffset (PR #88493)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 12 19:36:36 PDT 2024


================
@@ -5191,15 +5191,8 @@ bool SelectionDAG::isADDLike(SDValue Op) const {
 }
 
 bool SelectionDAG::isBaseWithConstantOffset(SDValue Op) const {
-  if ((Op.getOpcode() != ISD::ADD && Op.getOpcode() != ISD::OR) ||
-      !isa<ConstantSDNode>(Op.getOperand(1)))
-    return false;
-
-  if (Op.getOpcode() == ISD::OR &&
-      !MaskedValueIsZero(Op.getOperand(0), Op.getConstantOperandAPInt(1)))
-    return false;
-
-  return true;
+  return isa<ConstantSDNode>(Op.getOperand(1)) &&
----------------
nikic wrote:

This will crash if the node doesn't have a second operand.

https://github.com/llvm/llvm-project/pull/88493


More information about the llvm-commits mailing list