Skip to content

Commit 4168185

Browse files
RKSimonyuxuanchen1997
authored andcommitted
[DAG] tryToFoldExtendSelectLoad - reuse existing SDLoc. NFC.
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250806
1 parent fab3f15 commit 4168185

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12812,13 +12812,11 @@ static bool isCompatibleLoad(SDValue N, unsigned ExtOpcode) {
1281212812
/// This function is called by the DAGCombiner when visiting sext/zext/aext
1281312813
/// dag nodes (see for example method DAGCombiner::visitSIGN_EXTEND).
1281412814
static SDValue tryToFoldExtendSelectLoad(SDNode *N, const TargetLowering &TLI,
12815-
SelectionDAG &DAG,
12815+
SelectionDAG &DAG, const SDLoc &DL,
1281612816
CombineLevel Level) {
1281712817
unsigned Opcode = N->getOpcode();
1281812818
SDValue N0 = N->getOperand(0);
1281912819
EVT VT = N->getValueType(0);
12820-
SDLoc DL(N);
12821-
1282212820
assert((Opcode == ISD::SIGN_EXTEND || Opcode == ISD::ZERO_EXTEND ||
1282312821
Opcode == ISD::ANY_EXTEND) &&
1282412822
"Expected EXTEND dag node in input!");
@@ -13775,7 +13773,7 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
1377513773
return DAG.getNode(ISD::ADD, DL, VT, Zext, DAG.getAllOnesConstant(DL, VT));
1377613774
}
1377713775

13778-
if (SDValue Res = tryToFoldExtendSelectLoad(N, TLI, DAG, Level))
13776+
if (SDValue Res = tryToFoldExtendSelectLoad(N, TLI, DAG, DL, Level))
1377913777
return Res;
1378013778

1378113779
return SDValue();
@@ -13860,8 +13858,7 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
1386013858
// fold (zext (zext_extend_vector_inreg x)) -> (zext_extend_vector_inreg x)
1386113859
if (N0.getOpcode() == ISD::ANY_EXTEND_VECTOR_INREG ||
1386213860
N0.getOpcode() == ISD::ZERO_EXTEND_VECTOR_INREG)
13863-
return DAG.getNode(ISD::ZERO_EXTEND_VECTOR_INREG, SDLoc(N), VT,
13864-
N0.getOperand(0));
13861+
return DAG.getNode(ISD::ZERO_EXTEND_VECTOR_INREG, DL, VT, N0.getOperand(0));
1386513862

1386613863
// fold (zext (truncate x)) -> (zext x) or
1386713864
// (zext (truncate x)) -> (truncate x)
@@ -14147,7 +14144,7 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
1414714144
if (SDValue V = widenAbs(N, DAG))
1414814145
return V;
1414914146

14150-
if (SDValue Res = tryToFoldExtendSelectLoad(N, TLI, DAG, Level))
14147+
if (SDValue Res = tryToFoldExtendSelectLoad(N, TLI, DAG, DL, Level))
1415114148
return Res;
1415214149

1415314150
// CSE zext nneg with sext if the zext is not free.
@@ -14322,7 +14319,7 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
1432214319
if (SDValue NewCtPop = widenCtPop(N, DAG))
1432314320
return NewCtPop;
1432414321

14325-
if (SDValue Res = tryToFoldExtendSelectLoad(N, TLI, DAG, Level))
14322+
if (SDValue Res = tryToFoldExtendSelectLoad(N, TLI, DAG, DL, Level))
1432614323
return Res;
1432714324

1432814325
return SDValue();

0 commit comments

Comments
 (0)