summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-07-16 17:33:13 +0000
committerChris Lattner <sabre@nondot.org>2002-07-16 17:33:13 +0000
commit036a13452813e2859708b2c0eaed2f93c2a9be74 (patch)
treee1897ed921d47b78dd3511c88eca64c35e1d17c5 /llvm/lib/Transforms
parent4b933a253feb3e767e44600ea5e35654eefaec23 (diff)
downloadbcm5719-llvm-036a13452813e2859708b2c0eaed2f93c2a9be74.tar.gz
bcm5719-llvm-036a13452813e2859708b2c0eaed2f93c2a9be74.zip
* 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 llvm-svn: 2920
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/ExprTypeConvert.cpp1
-rw-r--r--llvm/lib/Transforms/LevelRaise.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/ExprTypeConvert.cpp b/llvm/lib/Transforms/ExprTypeConvert.cpp
index a6106b08227..eea8607ed08 100644
--- a/llvm/lib/Transforms/ExprTypeConvert.cpp
+++ b/llvm/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/llvm/lib/Transforms/LevelRaise.cpp b/llvm/lib/Transforms/LevelRaise.cpp
index afc2ad5d7a6..2b9ff6d41b2 100644
--- a/llvm/lib/Transforms/LevelRaise.cpp
+++ b/llvm/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());
OpenPOWER on IntegriCloud