From b5e1610047a926ff6124a7f9d9a04acd44295183 Mon Sep 17 00:00:00 2001 From: ridethepig Date: Sat, 20 May 2023 13:33:40 +0800 Subject: [PATCH] switch to O1 flag --- src/main.cpp | 7 ++++--- src/pass_mem2reg.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 75b5361..a60dabf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -96,9 +96,10 @@ int main(int argc, const char **argv) { std::make_shared(), std::make_shared(), }; - - for (auto pass : passes) { - pass->run(visitor.module); + if (flg_O1) { + for (auto pass : passes) { + pass->run(visitor.module); + } } if (emit_llvm) { diff --git a/src/pass_mem2reg.cpp b/src/pass_mem2reg.cpp index 6a649e8..055b697 100644 --- a/src/pass_mem2reg.cpp +++ b/src/pass_mem2reg.cpp @@ -69,6 +69,18 @@ static void analyze_alloca(InstAllocaPtr_t ai, AllocaInfo &info) { info.only_in_1_block = false; } } + std::cout << "Alloca " << ai->name; + std::cout << " Def: ["; + for (auto blk : info.def_blocks) { + std::cout << blk->name << ", "; + } + std::cout << "]\n"; + std::cout << " Use: ["; + for (auto blk : info.def_blocks) { + std::cout << blk->name << ", "; + } + std::cout << "]\n"; + std::cout.flush(); } // static bool rewrite_single_store(InstAllocaPtr_t ai, AllocaInfo& alloca_info) {