Skip to content

Commit f20640b

Browse files
authored
[X86] PromoteMaskArithmetic - use similar code for LHS/RHS trunc pattern. NFC. (llvm#157426)
Make it more obvious that LHS/RHS truncation patterns are the same. Noticed while working on llvm#157425
1 parent 3dc314b commit f20640b

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50957,15 +50957,13 @@ static SDValue PromoteMaskArithmetic(SDValue N, const SDLoc &DL, EVT VT,
5095750957
if (SDValue NN0 = PromoteMaskArithmetic(N0, DL, VT, DAG, Depth + 1))
5095850958
N0 = NN0;
5095950959
else {
50960-
// The left side has to be a trunc.
50961-
if (N0.getOpcode() != ISD::TRUNCATE)
50962-
return SDValue();
50963-
50964-
// The type of the truncated inputs.
50965-
if (N0.getOperand(0).getValueType() != VT)
50960+
// The left side has to be a 'trunc'.
50961+
bool LHSTrunc = N0.getOpcode() == ISD::TRUNCATE &&
50962+
N0.getOperand(0).getValueType() == VT;
50963+
if (LHSTrunc)
50964+
N0 = N0.getOperand(0);
50965+
else
5096650966
return SDValue();
50967-
50968-
N0 = N0.getOperand(0);
5096950967
}
5097050968

5097150969
if (SDValue NN1 = PromoteMaskArithmetic(N1, DL, VT, DAG, Depth + 1))

0 commit comments

Comments
 (0)