[llvm-commits] [PATCH] Don't PRE compares

Hal Finkel hfinkel at anl.gov
Thu Mar 8 12:30:03 PST 2012


On Thu, 08 Mar 2012 10:53:09 -0800
Jakob Stoklund Olesen <jolesen at apple.com> wrote:

> The attached patch stops GVN from eliminating partially redundant
> compare instructions.
> 
> CodeGenPrepare sinks compares to their uses so that they can be fused
> with branches in isel. The phi node inserted by PRE prevents the
> sinking, and increases register pressure by forcing the i1 value into
> a general purpose register.
> 
> There is no way for CodeGenPrepare to figure this out on its own. Run
> the included test case through opt -O2 to see how value propagation
> messes with the i1 phi:
> 
>   %cmp3.pre-phi = phi i1 [ %cmp1, %if.then ], [ false, %entry ]
> 
> Owen suggested a more radical approach: Don't PRE instructions that
> have a single use in the same block. It solves a more general version
> of the same problem: PRE separates instructions that the code
> generator might have been able to fuse.

On this suggestion, we might want to use TLI, or some
extension thereof, to apply this only to operations that might actually
be fused on any particular target.

 -Hal

> 
> Thoughts?
> 
> /jakob
> 
> 



-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list