forked from OSchip/llvm-project
Avoid making unneeded load/mod/store transformation which can hurt performance.
llvm-svn: 29952
This commit is contained in:
parent
e5570a4c3f
commit
c07feb14b0
|
|
@ -80,6 +80,9 @@ namespace {
|
||||||
Statistic<>
|
Statistic<>
|
||||||
NumFPKill("x86-codegen", "Number of FP_REG_KILL instructions added");
|
NumFPKill("x86-codegen", "Number of FP_REG_KILL instructions added");
|
||||||
|
|
||||||
|
Statistic<>
|
||||||
|
NumLoadMoved("x86-codegen", "Number of loads moved below TokenFactor");
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
/// ISel - X86 specific code to select X86 machine instructions for
|
/// ISel - X86 specific code to select X86 machine instructions for
|
||||||
/// SelectionDAG operations.
|
/// SelectionDAG operations.
|
||||||
|
|
@ -313,8 +316,6 @@ void X86DAGToDAGISel::InstructionSelectPreprocess(SelectionDAG &DAG) {
|
||||||
switch (Opcode) {
|
switch (Opcode) {
|
||||||
case ISD::ADD:
|
case ISD::ADD:
|
||||||
case ISD::MUL:
|
case ISD::MUL:
|
||||||
case ISD::FADD:
|
|
||||||
case ISD::FMUL:
|
|
||||||
case ISD::AND:
|
case ISD::AND:
|
||||||
case ISD::OR:
|
case ISD::OR:
|
||||||
case ISD::XOR:
|
case ISD::XOR:
|
||||||
|
|
@ -329,7 +330,8 @@ void X86DAGToDAGISel::InstructionSelectPreprocess(SelectionDAG &DAG) {
|
||||||
std::swap(N10, N11);
|
std::swap(N10, N11);
|
||||||
}
|
}
|
||||||
RModW = RModW && N10.Val->isOperand(Chain.Val) && N10.hasOneUse() &&
|
RModW = RModW && N10.Val->isOperand(Chain.Val) && N10.hasOneUse() &&
|
||||||
N10.getOperand(1) == N2;
|
(N10.getOperand(1) == N2) &&
|
||||||
|
(N10.Val->getValueType(0) == N1.getValueType());
|
||||||
if (RModW)
|
if (RModW)
|
||||||
Load = N10;
|
Load = N10;
|
||||||
break;
|
break;
|
||||||
|
|
@ -347,15 +349,18 @@ void X86DAGToDAGISel::InstructionSelectPreprocess(SelectionDAG &DAG) {
|
||||||
SDOperand N10 = N1.getOperand(0);
|
SDOperand N10 = N1.getOperand(0);
|
||||||
if (N10.Val->getOpcode() == ISD::LOAD)
|
if (N10.Val->getOpcode() == ISD::LOAD)
|
||||||
RModW = N10.Val->isOperand(Chain.Val) && N10.hasOneUse() &&
|
RModW = N10.Val->isOperand(Chain.Val) && N10.hasOneUse() &&
|
||||||
N10.getOperand(1) == N2;
|
(N10.getOperand(1) == N2) &&
|
||||||
|
(N10.Val->getValueType(0) == N1.getValueType());
|
||||||
if (RModW)
|
if (RModW)
|
||||||
Load = N10;
|
Load = N10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RModW)
|
if (RModW) {
|
||||||
MoveBelowTokenFactor(DAG, Load, SDOperand(I, 0), Chain);
|
MoveBelowTokenFactor(DAG, Load, SDOperand(I, 0), Chain);
|
||||||
|
++NumLoadMoved;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue