Jimborean Alexandra
2011-May-17 14:09 UTC
[LLVMdev] eliminate phi nodes, reduce unnecessary loads / stores , reg2mem, mem2reg
Hi, I work on a pass that requires as input LLVM code without any phi nodes. For this, I use the reg2mem pass which produces suitable code, the pass runs correctly, but I obtain a significant performance decrease. I expect that this is because there are more reads / writes to memory after running the reg2mem pass. How can I optimize the code, without inserting any phi nodes? Or is there a better solution to eliminate the phi nodes in the first place? The solution that comes to my mind is to run a custom version of the mem2reg pass. That would mean, after running the reg2mem pass, to eliminate unnecessary load / store instructions, if this can be done without inserting any phi nodes. Do you think this can be achieved and is it the right way to go? Thank you, Alexandra -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110517/069ca256/attachment.html>
Reid Kleckner
2011-May-17 17:04 UTC
[LLVMdev] eliminate phi nodes, reduce unnecessary loads / stores , reg2mem, mem2reg
Generally, no. For variables with multiple assignments, you can either have loads and stores to allocas, or virtual registers with phi nodes. This is a feature of LLVM IR, there is no non-SSA form using virtual registers. Is it possible for you to run reg2mem, your pass, and then mem2reg again? That's the intended usage of reg2mem. Reid On Tue, May 17, 2011 at 10:09 AM, Jimborean Alexandra <xinfinity_a at yahoo.com> wrote:> Hi, > > I work on a pass that requires as input LLVM code without any phi nodes. For > this, I use the reg2mem pass which produces suitable code, the pass runs > correctly, but I obtain a significant performance decrease. I expect that > this is because there are more reads / writes to memory after running the > reg2mem pass. > How can I optimize the code, without inserting any phi nodes? Or is there a > better solution to eliminate the phi nodes in the first place? > > The solution that comes to my mind is to run a custom version of the mem2reg > pass. That would mean, after running the reg2mem pass, to eliminate > unnecessary load / store instructions, if this can be done without inserting > any phi nodes. > > Do you think this can be achieved and is it the right way to go? > > Thank you, > Alexandra > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Seemingly Similar Threads
- [LLVMdev] scalar evolution to determine access functions in arays
- [LLVMdev] scalar evolution to determine access functions in arays
- [LLVMdev] scalar evolution to determine access functions in arays
- [LLVMdev] scalar evolution to determine access functions in arays
- [LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass