[LLVMdev] Register Pressure Computation during Pre-Allocation Scheduling

Ghassan Shobaki ghassan_shobaki at yahoo.com
Tue Aug 16 02:08:30 PDT 2011



Thank you for the answers, Jakob! That's really informative for someone who is still new to LLVM like me. Please see my responses below.

-Ghassan  



________________________________
From: Jakob Stoklund Olesen <stoklund at 2pi.dk>
To: Ghassan Shobaki <ghassan_shobaki at yahoo.com>
Cc: "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu>
Sent: Tuesday, August 16, 2011 12:52 AM
Subject: Re: [LLVMdev] Register Pressure Computation during Pre-Allocation Scheduling




On Aug 15, 2011, at 1:27 AM, Ghassan Shobaki wrote:

>This information is only computed immediately before register allocation. Passes that run after scheduling can significantly change the register pressure. In
> particular MachineCSE and MachineLICM do this.

Ghassan: I know that phase ordering is a non-trivial problem that does not have a perfect solution (like most compiler optimization problems!), but I wonder why LLVM runs such passes between scheduling and allocation. One would expect a register pressure reduction pass to be placed as close as possible to the register allocation pass. Ideally, you would like to have an integrated algorithm that does allocation and scheduling simultaneously, but such an integrated solution is usually not implemented due to its complexity. So, my questions are:
(1) CSE naturally tends to increase reg pressure. Is there any particular reason for doing CSE between scheduling and allocation instead of doing it, say before scheduling?
(2) How easy will it be to change the phase ordering in LLVM without breaking things? Where is the phase ordering done? How do we know if there are dependencies among certain phases?
(3) Does LLVM have command-line options for turning off phases like CSE and LICM? 




>These DAG nodes are also used to copy to/from physical registers before and after calls.
>Virtual registers defined by PHI instructions will also appear as CopyFromReg operands.
Ghassan: So, is there a way to distinguish the ones that represent live-in and live-out regs?
Failing to recognize CopyFromReg and CopyToReg instrs that represent live-in/live-out regs, our scheduler will treat them as regular instructions and may move some of them to the middle of the block, thus resulting in an incorrect under-estimate of reg pressure. We would like to avoid that if possible. 

/jakob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110816/1e1c6b36/attachment.html>


More information about the llvm-dev mailing list