mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 06:32:24 +00:00
Don't barf on empty basic blocks. Do not rely on assert
doing something - this needs to work for release builds too. I chose to just abort rather than following the fancy logic of abortIfBroken, because (1) it is a pain to do otherwise, and (2) nothing is going to work if the module is this broken. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43611 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d03a6a9242
commit
d0561900f3
@ -69,22 +69,34 @@ using namespace llvm;
|
|||||||
namespace { // Anonymous namespace for class
|
namespace { // Anonymous namespace for class
|
||||||
struct VISIBILITY_HIDDEN PreVerifier : public FunctionPass {
|
struct VISIBILITY_HIDDEN PreVerifier : public FunctionPass {
|
||||||
static char ID; // Pass ID, replacement for typeid
|
static char ID; // Pass ID, replacement for typeid
|
||||||
|
|
||||||
PreVerifier() : FunctionPass((intptr_t)&ID) { }
|
PreVerifier() : FunctionPass((intptr_t)&ID) { }
|
||||||
|
|
||||||
|
// Check that the prerequisites for successful DominatorTree construction
|
||||||
|
// are satisfied.
|
||||||
bool runOnFunction(Function &F) {
|
bool runOnFunction(Function &F) {
|
||||||
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
|
bool Broken = false;
|
||||||
assert(I->back().isTerminator()
|
|
||||||
&& "Block does not end with a terminator?");
|
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
|
||||||
|
if (I->empty() || !I->back().isTerminator()) {
|
||||||
return false;
|
cerr << "Basic Block does not have terminator!\n";
|
||||||
|
WriteAsOperand(*cerr, I, true);
|
||||||
|
cerr << "\n";
|
||||||
|
Broken = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Broken)
|
||||||
|
abort();
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
char PreVerifier::ID = 0;
|
char PreVerifier::ID = 0;
|
||||||
RegisterPass<PreVerifier> PreVer("preverify", "Preliminary module verification");
|
RegisterPass<PreVerifier> PreVer("preverify", "Preliminary module verification");
|
||||||
const PassInfo *PreVerifyID = PreVer.getPassInfo();
|
const PassInfo *PreVerifyID = PreVer.getPassInfo();
|
||||||
|
|
||||||
struct VISIBILITY_HIDDEN
|
struct VISIBILITY_HIDDEN
|
||||||
Verifier : public FunctionPass, InstVisitor<Verifier> {
|
Verifier : public FunctionPass, InstVisitor<Verifier> {
|
||||||
static char ID; // Pass ID, replacement for typeid
|
static char ID; // Pass ID, replacement for typeid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user