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
This commit is contained in:
Zhou Sheng
2007-01-11 12:24:14 +00:00
parent 057809ac1c
commit 6b6b6ef167
43 changed files with 1974 additions and 1868 deletions

View File

@@ -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;