[llvm] [RISCV] Fix crash in combinePExtTruncate for truncate(srl) without MUL/SUB (PR #186141)

Kito Cheng via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 12 08:50:02 PDT 2026


================
@@ -16965,6 +16965,10 @@ static SDValue combinePExtTruncate(SDNode *N, SelectionDAG &DAG,
     }
   }
 
+  // Ensure Op is a binary operation before accessing its operands.
+  if (Op.getNumOperands() < 2)
----------------
kito-cheng wrote:

I just little struggle when I writing the condition since we may have ternary (or more), but I don't see that candidate in short term, so let me update to fit the comment :P

https://github.com/llvm/llvm-project/pull/186141


More information about the llvm-commits mailing list