[llvm] 1138adf - [RISCV] Use SDValue::getValueType() instead of SDNode:getValueType(0). NFC (#217739)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 13:02:39 PDT 2026


Author: Craig Topper
Date: 2026-08-20T20:02:34Z
New Revision: 1138adf4638567039f48bcb66e500de92dea662c

URL: https://github.com/llvm/llvm-project/commit/1138adf4638567039f48bcb66e500de92dea662c
DIFF: https://github.com/llvm/llvm-project/commit/1138adf4638567039f48bcb66e500de92dea662c.diff

LOG: [RISCV] Use SDValue::getValueType() instead of SDNode:getValueType(0). NFC (#217739)

We don't know that the condition is using result 0 so we should use the
result number from the SDValue.

NFC because I don't know of a node that can get here with multiple
results where result 0 would have a different type than result 1 while
result 1 is a boolean value. Type legalization to XLenVT prevents this.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 0208816a8f8a8..1db51b19fde2d 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -10634,7 +10634,7 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
       }
       if ((FalseVal - TrueVal).isPowerOf2() && TrueVal.isSignedIntN(12)) {
         SDValue Log2 = DAG.getConstant((FalseVal - TrueVal).logBase2(), DL, VT);
-        CondV = DAG.getLogicalNOT(DL, CondV, CondV->getValueType(0));
+        CondV = DAG.getLogicalNOT(DL, CondV, CondV.getValueType());
         SDValue BitDiff = DAG.getNode(ISD::SHL, DL, VT, CondV, Log2);
         return DAG.getNode(ISD::ADD, DL, VT, BitDiff, TrueV);
       }


        


More information about the llvm-commits mailing list