[llvm] r343419 - [X86] Copy memrefs when folding a load for division instruction selection.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 30 10:47:18 PDT 2018
Author: ctopper
Date: Sun Sep 30 10:47:18 2018
New Revision: 343419
URL: http://llvm.org/viewvc/llvm-project?rev=343419&view=rev
Log:
[X86] Copy memrefs when folding a load for division instruction selection.
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=343419&r1=343418&r2=343419&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Sun Sep 30 10:47:18 2018
@@ -3266,20 +3266,22 @@ void X86DAGToDAGISel::Select(SDNode *Nod
if (NVT == MVT::i8 && (!isSigned || signBitIsZero)) {
// Special case for div8, just use a move with zero extension to AX to
// clear the upper 8 bits (AH).
- SDValue Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, Move, Chain;
+ SDValue Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, Chain;
+ MachineSDNode *Move;
if (tryFoldLoad(Node, N0, Tmp0, Tmp1, Tmp2, Tmp3, Tmp4)) {
SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, N0.getOperand(0) };
- Move =
- SDValue(CurDAG->getMachineNode(X86::MOVZX32rm8, dl, MVT::i32,
- MVT::Other, Ops), 0);
- Chain = Move.getValue(1);
+ Move = CurDAG->getMachineNode(X86::MOVZX32rm8, dl, MVT::i32,
+ MVT::Other, Ops);
+ Chain = SDValue(Move, 1);
ReplaceUses(N0.getValue(1), Chain);
+ // Record the mem-refs
+ CurDAG->setNodeMemRefs(Move, {cast<LoadSDNode>(N0)->getMemOperand()});
} else {
- Move =
- SDValue(CurDAG->getMachineNode(X86::MOVZX32rr8, dl, MVT::i32, N0),0);
+ Move = CurDAG->getMachineNode(X86::MOVZX32rr8, dl, MVT::i32, N0);
Chain = CurDAG->getEntryNode();
}
- Chain = CurDAG->getCopyToReg(Chain, dl, X86::EAX, Move, SDValue());
+ Chain = CurDAG->getCopyToReg(Chain, dl, X86::EAX, SDValue(Move, 0),
+ SDValue());
InFlag = Chain.getValue(1);
} else {
InFlag =
More information about the llvm-commits
mailing list