diff options
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 6e7047c..4f280c3 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -2417,10 +2417,8 @@ unsigned RISCVTargetLowering::getVectorTypeBreakdownForCallingConv( // in the RISC-V ISA. May adjust compares to favor compare with 0 over compare // with 1/-1. static void translateSetCCForBranch(const SDLoc &DL, SDValue &LHS, SDValue &RHS, - ISD::CondCode &CC, SelectionDAG &DAG) { - const RISCVSubtarget &Subtarget = - DAG.getMachineFunction().getSubtarget<RISCVSubtarget>(); - + ISD::CondCode &CC, SelectionDAG &DAG, + const RISCVSubtarget &Subtarget) { // If this is a single bit test that can't be handled by ANDI, shift the // bit to be tested to the MSB and perform a signed compare with 0. if (isIntEqualitySetCC(CC) && isNullConstant(RHS) && @@ -9238,7 +9236,7 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const { return DAG.getNode(ISD::SUB, DL, VT, FalseV, CondV); } - translateSetCCForBranch(DL, LHS, RHS, CCVal, DAG); + translateSetCCForBranch(DL, LHS, RHS, CCVal, DAG, Subtarget); // 1 < x ? x : 1 -> 0 < x ? x : 1 if (isOneConstant(LHS) && (CCVal == ISD::SETLT || CCVal == ISD::SETULT) && RHS == TrueV && LHS == FalseV) { @@ -9280,7 +9278,7 @@ SDValue RISCVTargetLowering::lowerBRCOND(SDValue Op, SelectionDAG &DAG) const { SDValue RHS = CondV.getOperand(1); ISD::CondCode CCVal = cast<CondCodeSDNode>(CondV.getOperand(2))->get(); - translateSetCCForBranch(DL, LHS, RHS, CCVal, DAG); + translateSetCCForBranch(DL, LHS, RHS, CCVal, DAG, Subtarget); SDValue TargetCC = DAG.getCondCode(CCVal); return DAG.getNode(RISCVISD::BR_CC, DL, Op.getValueType(), Op.getOperand(0), @@ -18224,7 +18222,7 @@ static bool combine_CC(SDValue &LHS, SDValue &RHS, SDValue &CC, const SDLoc &DL, RHS = LHS.getOperand(1); LHS = LHS.getOperand(0); - translateSetCCForBranch(DL, LHS, RHS, CCVal, DAG); + translateSetCCForBranch(DL, LHS, RHS, CCVal, DAG, Subtarget); CC = DAG.getCondCode(CCVal); return true; |