[RISCV] Use setcc's original SDLoc when inverting it in performSUBCombine.
authorCraig Topper <craig.topper@sifive.com>
Tue, 16 Aug 2022 22:19:51 +0000 (15:19 -0700)
committerCraig Topper <craig.topper@sifive.com>
Tue, 16 Aug 2022 22:40:09 +0000 (15:40 -0700)
We change seteq<->setne but it doesn't change the semantics
of the setcc. We should keep original debug location. This is
consistent with visitXor in the generic DAGCombiner.

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

index fc9e8d4..11ee31a 100644 (file)
@@ -8298,8 +8298,8 @@ static SDValue performSUBCombine(SDNode *N, SelectionDAG &DAG) {
       // and may increase the number of constants we need.
       if (ImmValMinus1.isSignedIntN(12)) {
         CCVal = ISD::getSetCCInverse(CCVal, SetCCOpVT);
-        SDValue NewN0 =
-            DAG.getSetCC(SDLoc(N), VT, N1.getOperand(0), N1.getOperand(1), CCVal);
+        SDValue NewN0 = DAG.getSetCC(SDLoc(N0), VT, N1.getOperand(0),
+                                     N1.getOperand(1), CCVal);
         SDValue NewN1 = DAG.getConstant(ImmValMinus1, SDLoc(N), VT);
         return DAG.getNode(ISD::ADD, SDLoc(N), VT, NewN0, NewN1);
       }