From 6b6b6ef1677fa71b1072c2911b4c1f9524a558c9 Mon Sep 17 00:00:00 2001 From: Zhou Sheng Date: Thu, 11 Jan 2007 12:24:14 +0000 Subject: For PR1043: Merge ConstantIntegral and ConstantBool into ConstantInt. Remove ConstantIntegral and ConstantBool from LLVM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/CloneFunction.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/Transforms/Utils/CloneFunction.cpp') diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp index 896c39943c..cb98dc58e2 100644 --- a/lib/Transforms/Utils/CloneFunction.cpp +++ b/lib/Transforms/Utils/CloneFunction.cpp @@ -226,11 +226,14 @@ void PruningFunctionCloner::CloneBlock(const BasicBlock *BB) { if (const BranchInst *BI = dyn_cast(OldTI)) { if (BI->isConditional()) { // If the condition was a known constant in the callee... - ConstantBool *Cond = dyn_cast(BI->getCondition()); - if (Cond == 0) // Or is a known constant in the caller... - Cond = dyn_cast_or_null(ValueMap[BI->getCondition()]); - if (Cond) { // Constant fold to uncond branch! - BasicBlock *Dest = BI->getSuccessor(!Cond->getValue()); + ConstantInt *Cond = dyn_cast(BI->getCondition()); + // Or is a known constant in the caller... + if (Cond == 0) + Cond = dyn_cast_or_null(ValueMap[BI->getCondition()]); + + // Constant fold to uncond branch! + if (Cond) { + BasicBlock *Dest = BI->getSuccessor(!Cond->getBoolValue()); ValueMap[OldTI] = new BranchInst(Dest, NewBB); CloneBlock(Dest); TerminatorDone = true; -- cgit v1.2.3