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, - DAG.getConstant(-1, dl, ty(Op)), ISD::SETEQ); + DAG.getAllOnesConstant(dl, ty(Op)), ISD::SETEQ); return DAG.getMergeValues({Op, Ov}, dl); } } diff --git a/llvm/test/CodeGen/Hexagon/iss127296.ll b/llvm/test/CodeGen/Hexagon/iss127296.ll new file mode 100644 index 0000000000000..bf0e7a9881014 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/iss127296.ll @@ -0,0 +1,18 @@ +; RUN: llc -mtriple=hexagon -O0 < %s | FileCheck %s + +; CHECK: r0 = add(r0,#-1) + +define fastcc void @os.linux.tls.initStatic(i32 %x) { + %1 = call { i32, i1 } @llvm.usub.with.overflow.i32(i32 %x, i32 1) + br label %2 + + 2: ; preds = %0 + %3 = extractvalue { i32, i1 } %1, 0 + ret void +} + +; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) +declare { i32, i1 } @llvm.usub.with.overflow.i32(i32, i32) #0 + +attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } +