[llvm] r269215 - SDAG: Minor cleanup in X86
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Wed May 11 10:46:03 PDT 2016
Author: bogner
Date: Wed May 11 12:46:03 2016
New Revision: 269215
URL: http://llvm.org/viewvc/llvm-project?rev=269215&view=rev
Log:
SDAG: Minor cleanup in X86
Don't bother returning a result we don't use here. I've also renamed
this from selectGather to tryGather to better indicate that it may not
do anything.
Modified:
llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=269215&r1=269214&r2=269215&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Wed May 11 12:46:03 2016
@@ -197,7 +197,7 @@ namespace {
private:
void Select(SDNode *N) override;
- SDNode *selectGather(SDNode *N, unsigned Opc);
+ bool tryGather(SDNode *N, unsigned Opc);
bool foldOffsetIntoAddress(uint64_t Offset, X86ISelAddressMode &AM);
bool matchLoadInAddress(LoadSDNode *N, X86ISelAddressMode &AM);
@@ -1895,7 +1895,7 @@ static unsigned getFusedLdStOpcode(EVT &
}
/// Customized ISel for GATHER operations.
-SDNode *X86DAGToDAGISel::selectGather(SDNode *Node, unsigned Opc) {
+bool X86DAGToDAGISel::tryGather(SDNode *Node, unsigned Opc) {
// Operands of Gather: VSrc, Base, VIdx, VMask, Scale
SDValue Chain = Node->getOperand(0);
SDValue VSrc = Node->getOperand(2);
@@ -1904,7 +1904,7 @@ SDNode *X86DAGToDAGISel::selectGather(SD
SDValue VMask = Node->getOperand(5);
ConstantSDNode *Scale = dyn_cast<ConstantSDNode>(Node->getOperand(6));
if (!Scale)
- return nullptr;
+ return false;
SDVTList VTs = CurDAG->getVTList(VSrc.getValueType(), VSrc.getValueType(),
MVT::Other);
@@ -1923,7 +1923,8 @@ SDNode *X86DAGToDAGISel::selectGather(SD
// of ResNode.
ReplaceUses(SDValue(Node, 0), SDValue(ResNode, 0));
ReplaceUses(SDValue(Node, 1), SDValue(ResNode, 2));
- return ResNode;
+ CurDAG->RemoveDeadNode(Node);
+ return true;
}
void X86DAGToDAGISel::Select(SDNode *Node) {
@@ -2005,9 +2006,7 @@ void X86DAGToDAGISel::Select(SDNode *Nod
case Intrinsic::x86_avx2_gather_q_d: Opc = X86::VPGATHERQDrm; break;
case Intrinsic::x86_avx2_gather_q_d_256: Opc = X86::VPGATHERQDYrm; break;
}
- SDNode *RetVal = selectGather(Node, Opc);
- if (RetVal)
- // We already called ReplaceUses inside SelectGather.
+ if (tryGather(Node, Opc))
return;
break;
}
More information about the llvm-commits
mailing list