From 7851529456fdfd8f701bc553d7f23cda3a29891d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 28 Sep 2006 23:14:29 +0000 Subject: [PATCH] Simplify some code llvm-svn: 30658 --- lib/Analysis/ConstantRange.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Analysis/ConstantRange.cpp b/lib/Analysis/ConstantRange.cpp index 109ed42cfc2..beb61754fc7 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(CI)) + return ConstantBool::get(!CB->getValue()); Constant *Result = ConstantExpr::getAdd(CI, ConstantInt::get(CI->getType(), 1));