fix a bug I introduced, no idea how this didn't repro right.
authorChris Lattner <sabre@nondot.org>
Thu, 14 Oct 2010 00:30:00 +0000 (00:30 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 14 Oct 2010 00:30:00 +0000 (00:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116462 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APInt.cpp
test/Transforms/ConstProp/overflow-ops.ll

index 3807314bac478e21568ebd3a4dfe8b1c16ede0cf..88f9ac63f7e99e9ff9ac07aabd27e1d0be6d56df 100644 (file)
@@ -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;
 }
 
index 50dc20566deedf8525d293fce7bf75b693fb8c57..5587e9b623300780f0898094c2d1c66f385d9d2c 100644 (file)
@@ -1,5 +1,4 @@
-; RUN: true
-; opt < %s -constprop -S | FileCheck %s
+; RUN: opt < %s -constprop -S | FileCheck %s
 
 %i8i1 = type {i8, i1}