mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Fix PR1752 and LoopSimplify/2007-10-28-InvokeCrash.ll: terminators
can have uses too. Wouldn't it be nice if invoke didn't exist? :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43426 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
|
||||
#define DEBUG_TYPE "loopsimplify"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Constant.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Type.h"
|
||||
@@ -158,12 +158,14 @@ bool LoopSimplify::runOnFunction(Function &F) {
|
||||
for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
|
||||
TI->getSuccessor(i)->removePredecessor(BB);
|
||||
|
||||
// Add a new unreachable instruction.
|
||||
// Add a new unreachable instruction before the old terminator.
|
||||
new UnreachableInst(TI);
|
||||
|
||||
// Delete the dead terminator.
|
||||
if (AA) AA->deleteValue(&BB->back());
|
||||
BB->getInstList().pop_back();
|
||||
if (AA) AA->deleteValue(TI);
|
||||
if (!TI->use_empty())
|
||||
TI->replaceAllUsesWith(UndefValue::get(TI->getType()));
|
||||
TI->eraseFromParent();
|
||||
Changed |= true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user