[llvm] [AVR] Fix codegen after getConstant assertions got enabled (PR #152269)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 02:37:03 PDT 2025


================
@@ -713,7 +713,7 @@ SDValue AVRTargetLowering::getAVRCmp(SDValue LHS, SDValue RHS, ISD::CondCode CC,
     // Turn lhs < rhs with lhs constant into rhs >= lhs+1, this allows us to
     // fold the constant into the cmp instruction.
     if (const ConstantSDNode *C = dyn_cast<ConstantSDNode>(RHS)) {
-      RHS = DAG.getConstant(C->getSExtValue() + 1, DL, VT);
+      RHS = DAG.getSignedConstant(C->getSExtValue() + 1, DL, VT);
----------------
RKSimon wrote:

Should this be `DAG.getConstant(C->getZExtValue() + 1, DL, VT);` its an unsigned compare

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


More information about the llvm-commits mailing list