[llvm-commits] [PATCH] Stack Coloring optimization

Sergei Larin slarin at codeaurora.org
Tue Sep 4 14:07:03 PDT 2012


Nadav, 

 Here are my 2c.

I echo the concern expressed by Jakob, but after porting this patch to
Hexagon and trying it out, in fairness, I see no performance impact (or real
benefit) on our internal test suite, which has the scenario you are trying
to address here... (with the obvious caveat that it really operates as
intended)...
But if in the future, it will reduce in any way aliasing resolution during
MI scheduling, this might become a serious issue for Hexagon. If you can in
any way easy my concerns, I would really appreciate it.

Thanks.

Sergei

---
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
The Linux Foundation


> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
> bounces at cs.uiuc.edu] On Behalf Of Jakob Stoklund Olesen
> Sent: Thursday, August 30, 2012 1:58 PM
> To: Nadav Rotem
> Cc: llvm-commits at cs.uiuc.edu
> Subject: Re: [llvm-commits] [PATCH] Stack Coloring optimization
> 
> 
> On Aug 30, 2012, at 2:51 AM, Nadav Rotem <nrotem at apple.com> wrote:
> 
> > Hi All,
> >
> > I've been working on a new optimization for reducing the stack size.
> Currently, when we declare allocas in LLVM IR, these allocas are
> directly translated to stack slots. And when we inline small functions
> into larger function, these allocas add up and take up lots of space.
> In some cases we know that the use of the allocas is bounded by
> disjoint regions.  In this optimization we merge multiple disjoint
> slots into a single slot.  LLVM uses the lifetime markers for
> specifying the regions in which the allcoa is used.  This patch
> propagates the lifetime markers through SelectionDAG and makes them
> pseudo ops.  Later, a pre-register-allocator pass constructs live
> intervals which represent the lifeless of different stack slots. Next,
> the pass merges disjoint intervals.  Notice that lifetime markers and
> not perfect single-entry-single exit regions. They may be removed by
> optimizations, they may start with two markers, and end with one, or
> even not end at all!
> >
> > So, why is this done in codegen?  There are a number of reasons.
> First, joining allocas may hinder alias analysis. Second, in the future
> we would like to share the alloca space with spill slots.
> 
> About alias analysis. Andy was just showing me the scheduler's AA code.
> It is using the memory operands to find the underlying LLVM IR object.
> Loads and stores to different allocas are partitioned according to
> their underlying IR object.
> 
> Merging stack slots before the MI scheduler could invalidate this form
> of alias analysis since two IR allocas can share a stack slot.
> 
> /jakob
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list