[llvm] [LoongArch] Fix assertion failure in performORCombine (PR #141586)

via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 06:35:34 PDT 2025


================
@@ -4410,7 +4410,7 @@ static SDValue performORCombine(SDNode *N, SelectionDAG &DAG,
     LLVM_DEBUG(dbgs() << "Perform OR combine: match pattern 5\n");
     return DAG.getNode(
         LoongArchISD::BSTRINS, DL, ValTy, N0.getOperand(0),
-        DAG.getConstant(CN1->getSExtValue() >> MaskIdx0, DL, ValTy),
+        DAG.getSignedConstant(CN1->getSExtValue() >> MaskIdx0, DL, ValTy),
----------------
heiher wrote:

I came across a few more spots that might be risky, based on the data types and value ranges of `getConstant()` and `getTargetConstant()`.  I’ll include defensive fixes in this PR, but given the low risk and similarity of the cases, I’m not planning to add separate tests for each one.

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


More information about the llvm-commits mailing list