aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/JumpThreading.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-05 20:03:09 +0000
committerChris Lattner <sabre@nondot.org>2010-09-05 20:03:09 +0000
commit05ef361b5e356e8832ae95b657f24d1a70b739e6 (patch)
treed1ecdf9b03a5df571512f009db0814d94cd37008 /llvm/lib/Transforms/Scalar/JumpThreading.cpp
parenteea166dfd4568587adadc59fe0523976ee17c6e9 (diff)
downloadllvm-05ef361b5e356e8832ae95b657f24d1a70b739e6.zip
llvm-05ef361b5e356e8832ae95b657f24d1a70b739e6.tar.gz
llvm-05ef361b5e356e8832ae95b657f24d1a70b739e6.tar.bz2
eliminate some non-obvious casts. UndefValue isa Constant.
llvm-svn: 113113
Diffstat (limited to 'llvm/lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 104d5ae..da0e216 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -443,8 +443,8 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,PredValueInfo &Result){
// Try to use constant folding to simplify the binary operator.
for (unsigned i = 0, e = LHSVals.size(); i != e; ++i) {
- Constant *V = LHSVals[i].first ? LHSVals[i].first :
- cast<Constant>(UndefValue::get(BO->getType()));
+ Constant *V = LHSVals[i].first;
+ if (V == 0) V = UndefValue::get(BO->getType());
Constant *Folded = ConstantExpr::get(BO->getOpcode(), V, CI);
PushConstantIntOrUndef(Result, Folded, LHSVals[i].second);
@@ -518,8 +518,8 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,PredValueInfo &Result){
ComputeValueKnownInPredecessors(I->getOperand(0), BB, LHSVals);
for (unsigned i = 0, e = LHSVals.size(); i != e; ++i) {
- Constant *V = LHSVals[i].first ? LHSVals[i].first :
- cast<Constant>(UndefValue::get(CmpConst->getType()));
+ Constant *V = LHSVals[i].first;
+ if (V == 0) V = UndefValue::get(CmpConst->getType());
Constant *Folded = ConstantExpr::getCompare(Cmp->getPredicate(),
V, CmpConst);
PushConstantIntOrUndef(Result, Folded, LHSVals[i].second);