}
if (New.Val != N) {
- CurDAG->ReplaceAllUsesWith(N, New.Val);
+ CurDAG->ReplaceAllUsesWith(Op, New);
N = New.Val;
}
break;
if (Chain != N->getOperand(0) || Val != N->getOperand(2)) {
SDOperand New = CurDAG->getNode(ISD::CopyToReg, MVT::Other,
Chain, Reg, Val);
- CurDAG->ReplaceAllUsesWith(N, New.Val);
+ CurDAG->ReplaceAllUsesWith(Op, New);
N = New.Val;
}
break;
if (Ty == MVT::i32) {
if (SDNode *I = SelectIntImmediateExpr(N->getOperand(0), N->getOperand(1),
PPC::ADDIS, PPC::ADDI, true)) {
- CurDAG->ReplaceAllUsesWith(N, I);
+ CurDAG->ReplaceAllUsesWith(Op, SDOperand(I, 0));
N = I;
} else {
CurDAG->SelectNodeTo(N, PPC::ADD, MVT::i32, Select(N->getOperand(0)),
}
if (SDNode *I = SelectIntImmediateExpr(N->getOperand(0), N->getOperand(1),
PPC::ADDIS, PPC::ADDI, true, true)) {
- CurDAG->ReplaceAllUsesWith(N, I);
+ CurDAG->ReplaceAllUsesWith(Op, SDOperand(I, 0));
N = I;
} else {
CurDAG->SelectNodeTo(N, PPC::SUBF, Ty, Select(N->getOperand(1)),
} else if (Imm) {
SDOperand Result = Select(BuildSDIVSequence(N));
assert(Result.ResNo == 0);
- CurDAG->ReplaceAllUsesWith(N, Result.Val);
+ CurDAG->ReplaceAllUsesWith(Op, Result);
N = Result.Val;
break;
}
if (isIntImmediate(N->getOperand(1), Imm) && Imm) {
SDOperand Result = Select(BuildUDIVSequence(N));
assert(Result.ResNo == 0);
- CurDAG->ReplaceAllUsesWith(N, Result.Val);
+ CurDAG->ReplaceAllUsesWith(Op, Result);
N = Result.Val;
break;
}
if (SDNode *I = SelectIntImmediateExpr(N->getOperand(0),
N->getOperand(1),
PPC::ANDISo, PPC::ANDIo)) {
- CurDAG->ReplaceAllUsesWith(N, I);
+ CurDAG->ReplaceAllUsesWith(Op, SDOperand(I, 0));
N = I;
break;
}
}
case ISD::OR:
if (SDNode *I = SelectBitfieldInsert(N)) {
- CurDAG->ReplaceAllUsesWith(N, I);
+ CurDAG->ReplaceAllUsesWith(Op, SDOperand(I, 0));
N = I;
break;
}
if (SDNode *I = SelectIntImmediateExpr(N->getOperand(0),
N->getOperand(1),
PPC::ORIS, PPC::ORI)) {
- CurDAG->ReplaceAllUsesWith(N, I);
+ CurDAG->ReplaceAllUsesWith(Op, SDOperand(I, 0));
N = I;
break;
}
if (SDNode *I = SelectIntImmediateExpr(N->getOperand(0),
N->getOperand(1),
PPC::XORIS, PPC::XORI)) {
- CurDAG->ReplaceAllUsesWith(N, I);
+ CurDAG->ReplaceAllUsesWith(Op, SDOperand(I, 0));
N = I;
break;
}
CurDAG->SelectNodeTo(N, PPC::FABS, N->getValueType(0),
Select(N->getOperand(0)));
break;
- case ISD::FP_EXTEND:
+ case ISD::FP_EXTEND: {
assert(MVT::f64 == N->getValueType(0) &&
MVT::f32 == N->getOperand(0).getValueType() && "Illegal FP_EXTEND");
- CurDAG->SelectNodeTo(N, PPC::FMR, MVT::f64, Select(N->getOperand(0)));
- break;
+ SDOperand Tmp = Select(N->getOperand(0));
+ CurDAG->ReplaceAllUsesWith(Op, Tmp); // Just use the operand as the result.
+ return Tmp;
+ }
case ISD::FP_ROUND:
assert(MVT::f32 == N->getValueType(0) &&
MVT::f64 == N->getOperand(0).getValueType() && "Illegal FP_ROUND");