diff --git a/llvm/lib/Transforms/ExprTypeConvert.cpp b/llvm/lib/Transforms/ExprTypeConvert.cpp index a6106b08227b..eea8607ed08a 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(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 afc2ad5d7a67..2b9ff6d41b29 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());