[llvm] [AVR] Fix codegen after getConstant assertions got enabled (PR #152269)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 7 01:12:02 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);
----------------
aykevl wrote:
Looks like you are right. I changed it to `getConstant` and `getZExtValue` and it works (both the test I added and all TinyGo AVR tests pass with this patch applied).
https://github.com/llvm/llvm-project/pull/152269
More information about the llvm-commits
mailing list