summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit75b871fb1ecb121f84612864d97e79d90930232c (patch)
treeaf683c54f708c4ed3c49607a754c744fb1b1932d /llvm/lib/Transforms/Utils/CloneFunction.cpp
parent691b263e07d48c6a34eed2f0dd6e8150ff51a286 (diff)
downloadbcm5719-llvm-75b871fb1ecb121f84612864d97e79d90930232c.tar.gz
bcm5719-llvm-75b871fb1ecb121f84612864d97e79d90930232c.zip
For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt. Remove ConstantIntegral and ConstantBool from LLVM. llvm-svn: 33073
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CloneFunction.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 896c39943c2..cb98dc58e26 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud