summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/CorrelatedExprs.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-12 19:12:50 +0000
committerChris Lattner <sabre@nondot.org>2004-01-12 19:12:50 +0000
commit5585b335e560207a1e6977ff0f3ef7262f8f979f (patch)
treef495b51094f04c4e497f8437d680b3909482beeb /lib/Transforms/Scalar/CorrelatedExprs.cpp
parentc6646ebdb957a3c613d389be8b0135271b8b8ece (diff)
downloadllvm-5585b335e560207a1e6977ff0f3ef7262f8f979f.tar.gz
llvm-5585b335e560207a1e6977ff0f3ef7262f8f979f.tar.bz2
llvm-5585b335e560207a1e6977ff0f3ef7262f8f979f.tar.xz
Remove use of the ConstantHandling interfaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10793 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/CorrelatedExprs.cpp')
-rw-r--r--lib/Transforms/Scalar/CorrelatedExprs.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp
index f0c4071580..d9e96485fc 100644
--- a/lib/Transforms/Scalar/CorrelatedExprs.cpp
+++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp
@@ -27,10 +27,11 @@
//===----------------------------------------------------------------------===//
#include "llvm/Transforms/Scalar.h"
+#include "llvm/Constants.h"
#include "llvm/Pass.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
-#include "llvm/ConstantHandling.h"
+#include "llvm/Type.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Transforms/Utils/Local.h"
@@ -1129,20 +1130,10 @@ static bool CheckCondition(Constant *Bound, Constant *C,
assert(C != 0 && "C is not specified!");
if (Bound == 0) return false;
- ConstantBool *Val;
- switch (BO) {
- default: assert(0 && "Unknown Condition code!");
- case Instruction::SetEQ: Val = *Bound == *C; break;
- case Instruction::SetNE: Val = *Bound != *C; break;
- case Instruction::SetLT: Val = *Bound < *C; break;
- case Instruction::SetGT: Val = *Bound > *C; break;
- case Instruction::SetLE: Val = *Bound <= *C; break;
- case Instruction::SetGE: Val = *Bound >= *C; break;
- }
-
- // ConstantHandling code may not succeed in the comparison...
- if (Val == 0) return false;
- return !Val->getValue(); // Return true if the condition is false...
+ Constant *Val = ConstantExpr::get(BO, Bound, C);
+ if (ConstantBool *CB = dyn_cast<ConstantBool>(Val))
+ return !CB->getValue(); // Return true if the condition is false...
+ return false;
}
// contradicts - Return true if the relationship specified by the operand