[Hexagon] Explicitly truncate constant in UAddSubO by androm3da · Pull Request #127360 · llvm/llvm-project (original) (raw)

@llvm/pr-subscribers-backend-hexagon

Author: Brian Cain (androm3da)

Changes

After #117558 landed, this code would assert "Value is not an N-bit unsigned value" in getConstant(), from a test case in zig.

Co-authored-by: Craig Topper craig.topper@sifive.com
Fixes #127296


Full diff: https://github.com/llvm/llvm-project/pull/127360.diff

2 Files Affected:

diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp index 1a7667fe42fbc..b31360b4096da 100644 --- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp +++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp @@ -3273,7 +3273,7 @@ HexagonTargetLowering::LowerUAddSubO(SDValue Op, SelectionDAG &DAG) const { if (Opc == ISD::USUBO) { SDValue Op = DAG.getNode(ISD::SUB, dl, VTs.VTs[0], {X, Y}); SDValue Ov = DAG.getSetCC(dl, MVT::i1, Op,