diff options
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 4 | ||||
-rw-r--r-- | llvm/test/Transforms/ConstProp/overflow-ops.ll | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 3807314bac4..88f9ac63f7e 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -2067,8 +2067,8 @@ APInt APInt::ssub_ov(const APInt &RHS, bool &Overflow) const { } APInt APInt::usub_ov(const APInt &RHS, bool &Overflow) const { - APInt Res = *this+RHS; - Overflow = Res.ugt(RHS); + APInt Res = *this-RHS; + Overflow = Res.ugt(*this); return Res; } diff --git a/llvm/test/Transforms/ConstProp/overflow-ops.ll b/llvm/test/Transforms/ConstProp/overflow-ops.ll index 50dc20566de..5587e9b6233 100644 --- a/llvm/test/Transforms/ConstProp/overflow-ops.ll +++ b/llvm/test/Transforms/ConstProp/overflow-ops.ll @@ -1,5 +1,4 @@ -; RUN: true -; opt < %s -constprop -S | FileCheck %s +; RUN: opt < %s -constprop -S | FileCheck %s %i8i1 = type {i8, i1} |