diff --git a/bin/kecc.rs b/bin/kecc.rs index ad0e8ec..3b313fa 100644 --- a/bin/kecc.rs +++ b/bin/kecc.rs @@ -141,6 +141,26 @@ fn compile_ir( return; } + if matches.optimize { + O1::default().optimize(input); + } else { + if matches.simplify_cfg { + SimplifyCfg::default().optimize(input); + } + + if matches.mem2reg { + Mem2reg::default().optimize(input); + } + + if matches.deadcode { + Deadcode::default().optimize(input); + } + + if matches.gvn { + Gvn::default().optimize(input); + } + } + if let Some(path) = &matches.irviz { assert_eq!( Path::new(&path).extension(), @@ -181,26 +201,6 @@ fn compile_ir( temp_dir.close().expect("temp dir deletion failed"); } - if matches.optimize { - O1::default().optimize(input); - } else { - if matches.simplify_cfg { - SimplifyCfg::default().optimize(input); - } - - if matches.mem2reg { - Mem2reg::default().optimize(input); - } - - if matches.deadcode { - Deadcode::default().optimize(input); - } - - if matches.gvn { - Gvn::default().optimize(input); - } - } - if matches.iroutput { write(input, output).unwrap(); return;