Removed useless assert in ArrayLiteralExp::toConstElem

Added second verification pass after optimization
Commented an optimization pass out from lvl2, it turns the IR invalid, see llvm PR 2800
This commit is contained in:
Tomas Lindquist Olsen
2008-09-16 16:06:39 +02:00
parent 713a734d58
commit 1daa67ba50
3 changed files with 17 additions and 3 deletions

View File

@@ -41,7 +41,8 @@ void llvmdc_optimize_module(Module* m, char lvl, bool doinline)
pm.add(createIPConstantPropagationPass());
pm.add(createDeadArgEliminationPass());
pm.add(createInstructionCombiningPass());
pm.add(createCFGSimplificationPass());
// this doesn't work, llvm PR 2800
//pm.add(createCFGSimplificationPass());
pm.add(createPruneEHPass());
}

View File

@@ -2219,8 +2219,6 @@ LLConstant* ArrayLiteralExp::toConstElem(IRState* p)
// dynamic arrays can occur here as well ...
bool dyn = (bt->ty == Tarray);
if (!dyn)
assert(arrtype->getNumElements() == elements->dim);
// build the initializer
std::vector<LLConstant*> vals(elements->dim, NULL);

View File

@@ -154,6 +154,21 @@ void Module::genobjfile(int multiobj)
// run optimizer
llvmdc_optimize_module(ir.module, global.params.optimizeLevel, global.params.llvmInline);
// verify the llvm
if (!global.params.novalidate && (global.params.optimizeLevel >= 0 || global.params.llvmInline)) {
std::string verifyErr;
Logger::println("Verifying module... again...");
LOG_SCOPE;
if (llvm::verifyModule(*ir.module,llvm::ReturnStatusAction,&verifyErr))
{
error("%s", verifyErr.c_str());
fatal();
}
else {
Logger::println("Verification passed!");
}
}
// eventually do our own path stuff, dmd's is a bit strange.
typedef llvm::sys::Path LLPath;
LLPath bcpath = LLPath(objfile->name->toChars());