diff options
author | Chris Lattner <sabre@nondot.org> | 2002-07-16 17:33:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-07-16 17:33:13 +0000 |
commit | 131454e91d51c01fa0193630390116ab55c7886e (patch) | |
tree | edc5e2f75bda3ec3987765bf4da34d9780d3800b /lib/Transforms | |
parent | b39df57bf3742db73e5b2c7af5b410f3b5fb2cca (diff) | |
download | external_llvm-131454e91d51c01fa0193630390116ab55c7886e.zip external_llvm-131454e91d51c01fa0193630390116ab55c7886e.tar.gz external_llvm-131454e91d51c01fa0193630390116ab55c7886e.tar.bz2 |
* Add assertion to ExprTypeConvert to detect error earlier than without it
* Fix bug in LevelRaise.cpp, correcting this problem:
test/Regression/Transforms/LevelRaise/2002-07-16-RaiseCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/ExprTypeConvert.cpp | 1 | ||||
-rw-r--r-- | lib/Transforms/LevelRaise.cpp | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index a6106b0..eea8607 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -903,6 +903,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, Instruction *I = cast<Instruction>(U); // Only Instructions convertable BasicBlock *BB = I->getParent(); + assert(BB != 0 && "Instruction not embedded in basic block!"); BasicBlock::InstListType &BIL = BB->getInstList(); std::string Name = I->getName(); if (!Name.empty()) I->setName(""); Instruction *Res; // Result of conversion diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp index afc2ad5..2b9ff6d 100644 --- a/lib/Transforms/LevelRaise.cpp +++ b/lib/Transforms/LevelRaise.cpp @@ -227,6 +227,7 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) { // source type of the cast... // ConvertedTypes.clear(); + ConvertedTypes[CI] = Src->getType(); // Make sure the cast _does_ change if (ValueConvertableToType(CI, Src->getType(), ConvertedTypes)) { PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", Src, CI, BB->getParent()); |