mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
Always print llvm on failure
This commit is contained in:
parent
b24a907662
commit
00945ff2eb
1 changed files with 11 additions and 8 deletions
|
@ -279,23 +279,26 @@ fn create_llvm_module<'a>(
|
|||
// Uncomment this to see the module's un-optimized LLVM instruction output:
|
||||
// env.module.print_to_stderr();
|
||||
|
||||
let panic_bad_llvm = |errors| {
|
||||
let path = std::env::temp_dir().join("test.ll");
|
||||
env.module.print_to_file(&path).unwrap();
|
||||
panic!(
|
||||
"Errors defining module:\n\n{}\n\nI have written the full module to `{:?}`",
|
||||
errors, path
|
||||
);
|
||||
};
|
||||
|
||||
if main_fn.verify(true) {
|
||||
function_pass.run_on(&main_fn);
|
||||
} else {
|
||||
panic!("Main function {} failed LLVM verification in NON-OPTIMIZED build. Uncomment things nearby to see more details.", main_fn_name);
|
||||
panic_bad_llvm(main_fn_name);
|
||||
}
|
||||
|
||||
module_pass.run_on(env.module);
|
||||
|
||||
// Verify the module
|
||||
if let Err(errors) = env.module.verify() {
|
||||
let path = std::env::temp_dir().join("test.ll");
|
||||
env.module.print_to_file(&path).unwrap();
|
||||
panic!(
|
||||
"Errors defining module:\n\n{}\n\nI have written the full module to `{:?}`",
|
||||
errors.to_string(),
|
||||
path
|
||||
);
|
||||
panic_bad_llvm(&errors.to_string());
|
||||
}
|
||||
|
||||
if let Ok(path) = std::env::var("ROC_DEBUG_LLVM") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue