Skip to content

Commit a834b79

Browse files
committed
[X86] foldMaskAndShiftToExtract - as long as we call insertDAGNode in the creation order then duplicates don't matter.
1 parent c931f2e commit a834b79

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,8 +1939,8 @@ static bool foldMaskAndShiftToExtract(SelectionDAG &DAG, SDValue N,
19391939
SDValue NewMask = DAG.getConstant(0xff, DL, XVT);
19401940
SDValue Srl = DAG.getNode(ISD::SRL, DL, XVT, X, Eight);
19411941
SDValue And = DAG.getNode(ISD::AND, DL, XVT, Srl, NewMask);
1942-
SDValue ShlCount = DAG.getConstant(ScaleLog, DL, MVT::i8);
19431942
SDValue Ext = DAG.getZExtOrTrunc(And, DL, VT);
1943+
SDValue ShlCount = DAG.getConstant(ScaleLog, DL, MVT::i8);
19441944
SDValue Shl = DAG.getNode(ISD::SHL, DL, VT, Ext, ShlCount);
19451945

19461946
// Insert the new nodes into the topological ordering. We must do this in
@@ -1949,12 +1949,11 @@ static bool foldMaskAndShiftToExtract(SelectionDAG &DAG, SDValue N,
19491949
// essentially a pre-flattened and pre-sorted sequence of nodes. There is no
19501950
// hierarchy left to express.
19511951
insertDAGNode(DAG, N, Eight);
1952-
insertDAGNode(DAG, N, Srl);
19531952
insertDAGNode(DAG, N, NewMask);
1953+
insertDAGNode(DAG, N, Srl);
19541954
insertDAGNode(DAG, N, And);
1955+
insertDAGNode(DAG, N, Ext);
19551956
insertDAGNode(DAG, N, ShlCount);
1956-
if (Ext != And)
1957-
insertDAGNode(DAG, N, Ext);
19581957
insertDAGNode(DAG, N, Shl);
19591958
DAG.ReplaceAllUsesWith(N, Shl);
19601959
DAG.RemoveDeadNode(N.getNode());

0 commit comments

Comments
 (0)