Skip to content

Commit 146e3a8

Browse files
committed
Revert "Update ARMISelLowering.cpp"
This reverts commit abbe349.
1 parent 4f3d817 commit 146e3a8

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20232,8 +20232,19 @@ static bool optimizeLogicalImm(SDValue Op, unsigned Imm, const APInt &Demanded,
2023220232
// Create the new constant immediate node.
2023320233
EVT VT = Op.getValueType();
2023420234
SDLoc DL(Op);
20235-
SDValue New = TLO.DAG.getNode(Op.getOpcode(), DL, VT, Op.getOperand(0),
20236-
TLO.DAG.getConstant(NewImm, DL, VT));
20235+
SDValue New;
20236+
20237+
// If the new constant immediate is all-zeros or all-ones, let the target
20238+
// independent DAG combine optimize this node.
20239+
if (NewImm == 0 || NewImm == ~0U) {
20240+
New = TLO.DAG.getNode(Op.getOpcode(), DL, VT, Op.getOperand(0),
20241+
TLO.DAG.getConstant(NewImm, DL, VT));
20242+
// Otherwise, create a machine node so that target independent DAG combine
20243+
// doesn't undo this optimization.
20244+
} else {
20245+
// Temporarily disable this optimization to avoid crashes
20246+
return false;
20247+
}
2023720248

2023820249
return TLO.CombineTo(Op, New);
2023920250
}

0 commit comments

Comments
 (0)