summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
authorZhou Sheng <zhousheng00@gmail.com>2007-01-11 12:24:14 +0000
committerZhou Sheng <zhousheng00@gmail.com>2007-01-11 12:24:14 +0000
commit6b6b6ef1677fa71b1072c2911b4c1f9524a558c9 (patch)
tree480ecf010ac5facd1bc29ab57441253691bb42d6 /lib/Transforms/Utils/CloneFunction.cpp
parent057809ac1c78c3456e8f1481330fa2bcd2b85029 (diff)
downloadllvm-6b6b6ef1677fa71b1072c2911b4c1f9524a558c9.tar.gz
llvm-6b6b6ef1677fa71b1072c2911b4c1f9524a558c9.tar.bz2
llvm-6b6b6ef1677fa71b1072c2911b4c1f9524a558c9.tar.xz
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
Diffstat (limited to 'lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp13
1 files changed, 8 insertions, 5 deletions
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<BranchInst>(OldTI)) {
if (BI->isConditional()) {
// If the condition was a known constant in the callee...
- ConstantBool *Cond = dyn_cast<ConstantBool>(BI->getCondition());
- if (Cond == 0) // Or is a known constant in the caller...
- Cond = dyn_cast_or_null<ConstantBool>(ValueMap[BI->getCondition()]);
- if (Cond) { // Constant fold to uncond branch!
- BasicBlock *Dest = BI->getSuccessor(!Cond->getValue());
+ ConstantInt *Cond = dyn_cast<ConstantInt>(BI->getCondition());
+ // Or is a known constant in the caller...
+ if (Cond == 0)
+ Cond = dyn_cast_or_null<ConstantInt>(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;