[llvm] r324865 - [X86] Don't look for TEST instruction shrinking opportunities when the root node is a X86ISD::SUB.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 11 19:02:02 PST 2018
Author: ctopper
Date: Sun Feb 11 19:02:02 2018
New Revision: 324865
URL: http://llvm.org/viewvc/llvm-project?rev=324865&view=rev
Log:
[X86] Don't look for TEST instruction shrinking opportunities when the root node is a X86ISD::SUB.
I don't believe we ever create an X86ISD::SUB with a 0 constant which is what the TEST handling needs. The ternary operator at the end of this code shows up as only going one way in the llvm-cov report from the bots.
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=324865&r1=324864&r2=324865&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Sun Feb 11 19:02:02 2018
@@ -3064,12 +3064,7 @@ void X86DAGToDAGISel::Select(SDNode *Nod
return;
}
- case X86ISD::CMP:
- case X86ISD::SUB: {
- // Sometimes a SUB is used to perform comparison.
- if (Opcode == X86ISD::SUB && Node->hasAnyUseOfValue(0))
- // This node is not a CMP.
- break;
+ case X86ISD::CMP: {
SDValue N0 = Node->getOperand(0);
SDValue N1 = Node->getOperand(1);
@@ -3131,10 +3126,8 @@ void X86DAGToDAGISel::Select(SDNode *Nod
// Emit a testl or testw.
SDNode *NewNode = CurDAG->getMachineNode(Op, dl, MVT::i32, Reg, Imm);
- // Replace SUB|CMP with TEST, since SUB has two outputs while TEST has
- // one, do not call ReplaceAllUsesWith.
- ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
- SDValue(NewNode, 0));
+ // Replace CMP with TEST.
+ CurDAG->ReplaceAllUsesWith(Node, NewNode);
CurDAG->RemoveDeadNode(Node);
return;
}
More information about the llvm-commits
mailing list