aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-09-28 23:14:29 +0000
committerChris Lattner <sabre@nondot.org>2006-09-28 23:14:29 +0000
commit193c2d886f96944fa5e4ecb9298a829a84bb8127 (patch)
tree409ec967d9acef251ea2e565b6b9f0711791e71c
parent32954718469b91193561c2efdc45db7d7cdd05df (diff)
Simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30658 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/ConstantRange.cpp4
-rw-r--r--lib/Support/ConstantRange.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/Analysis/ConstantRange.cpp b/lib/Analysis/ConstantRange.cpp
index 109ed42cfc..beb61754fc 100644
--- a/lib/Analysis/ConstantRange.cpp
+++ b/lib/Analysis/ConstantRange.cpp
@@ -30,8 +30,8 @@
using namespace llvm;
static ConstantIntegral *Next(ConstantIntegral *CI) {
- if (CI->getType() == Type::BoolTy)
- return CI == ConstantBool::True ? ConstantBool::False : ConstantBool::True;
+ if (ConstantBool *CB = dyn_cast<ConstantBool>(CI))
+ return ConstantBool::get(!CB->getValue());
Constant *Result = ConstantExpr::getAdd(CI,
ConstantInt::get(CI->getType(), 1));
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp
index 109ed42cfc..beb61754fc 100644
--- a/lib/Support/ConstantRange.cpp
+++ b/lib/Support/ConstantRange.cpp
@@ -30,8 +30,8 @@
using namespace llvm;
static ConstantIntegral *Next(ConstantIntegral *CI) {
- if (CI->getType() == Type::BoolTy)
- return CI == ConstantBool::True ? ConstantBool::False : ConstantBool::True;
+ if (ConstantBool *CB = dyn_cast<ConstantBool>(CI))
+ return ConstantBool::get(!CB->getValue());
Constant *Result = ConstantExpr::getAdd(CI,
ConstantInt::get(CI->getType(), 1));