mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-15 04:13:14 +01:00
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:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user