Why i have to do this mem2reg pass in bytecode optimization for obtaining another optimization pass result's? What's the use of mem2reg?
opt -dce myfile.bc
in this case i haven't changes in the output code
opt -mem2reg -dce myfile.bc
in this second case i have changes in the output code
edit: LLVR IR is still into SSa form, isn't it? using mem2reg i should have a "pruned" SSA form, is right?
mem2reg pass converts non-SSA form of LLVM IR into SSA form, raising loads and stores to stack-allocated values to "registers" (SSA values). Many of LLVM optimization passes operate on the code in SSA form and thus most probably will be no-op seeing IR in non-SSA form.
A bit more information is here: http://llvm.org/docs/Passes.html#mem2reg-promote-memory-to-register