aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/LevelRaise.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-07-17 17:11:33 +0000
committerChris Lattner <sabre@nondot.org>2002-07-17 17:11:33 +0000
commitb1b4262387b0060af9c01297d146bb17ed361a84 (patch)
tree55ce125fa359cca895f12352760831876b1fbe47 /lib/Transforms/LevelRaise.cpp
parent1ab8425c1c09c051459ef3bae2ecb087716cc3f5 (diff)
* Remove dead code from ExprTypeConvert.cpp
- I->use_empty() can never be true because of the IHolder's * Fix bug: test/Regression/Transforms/LevelRaise/2002-07-16-SourceAndDestCrash.ll - Add a new NewCasts member to VMC to keep track of casts that have been created and to ensure there is always a reference to the cast. - Extend ValueHandle a bit so it can be used in an STL container - Make sure we destroy the ValueMapCache before verifying the function in LevelRaise.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2936 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/LevelRaise.cpp')
-rw-r--r--lib/Transforms/LevelRaise.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index 94aebcbc65..7e27c5f7f0 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -225,17 +225,20 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
PRINT_PEEPHOLE3("CAST-SRC-EXPR-CONV:in ", Src, CI, BB->getParent());
DEBUG(cerr << "\nCONVERTING SRC EXPR TYPE:\n");
- ValueMapCache ValueMap;
- Value *E = ConvertExpressionToType(Src, DestTy, ValueMap);
- if (Constant *CPV = dyn_cast<Constant>(E))
- CI->replaceAllUsesWith(CPV);
+ { // ValueMap must be destroyed before function verified!
+ ValueMapCache ValueMap;
+ Value *E = ConvertExpressionToType(Src, DestTy, ValueMap);
- BI = BB->begin(); // Rescan basic block. BI might be invalidated.
- PRINT_PEEPHOLE1("CAST-SRC-EXPR-CONV:out", E);
- DEBUG(cerr << "DONE CONVERTING SRC EXPR TYPE: \n" << BB->getParent());
+ if (Constant *CPV = dyn_cast<Constant>(E))
+ CI->replaceAllUsesWith(CPV);
+
+ PRINT_PEEPHOLE1("CAST-SRC-EXPR-CONV:out", E);
+ DEBUG(cerr << "DONE CONVERTING SRC EXPR TYPE: \n" << BB->getParent());
+ }
DEBUG(assert(verifyFunction(*BB->getParent()) == false &&
"Function broken!"));
+ BI = BB->begin(); // Rescan basic block. BI might be invalidated.
++NumExprTreesConv;
return true;
}
@@ -249,15 +252,17 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", Src, CI, BB->getParent());
DEBUG(cerr << "\nCONVERTING EXPR TYPE:\n");
- ValueMapCache ValueMap;
- ConvertValueToNewType(CI, Src, ValueMap); // This will delete CI!
+ { // ValueMap must be destroyed before function verified!
+ ValueMapCache ValueMap;
+ ConvertValueToNewType(CI, Src, ValueMap); // This will delete CI!
+ }
- BI = BB->begin(); // Rescan basic block. BI might be invalidated.
PRINT_PEEPHOLE1("CAST-DEST-EXPR-CONV:out", Src);
DEBUG(cerr << "DONE CONVERTING EXPR TYPE: \n\n" << BB->getParent());
DEBUG(assert(verifyFunction(*BB->getParent()) == false &&
"Function broken!"));
+ BI = BB->begin(); // Rescan basic block. BI might be invalidated.
++NumExprTreesConv;
return true;
}