[PATCH] Constant Hoisting Pass
Hal Finkel
hfinkel at anl.gov
Thu Jan 23 15:44:03 PST 2014
Hi Juergen,
I think this looks useful, and I'd like to take advantage of this for PowerPC when it lands. One small request: I'd like to have some cost level in between "basic" and "load". There are constants on PPC that take a few add-cost instructions to materialize... hoisting these is likely useful, but loads of these constants should still be transformed into immediates (because the several integer instructions necessary are still cheaper than a load).
Thanks,
Hal
----- Original Message -----
> From: "Juergen Ributzka" <juergen at apple.com>
> To: "LLVM Commits" <llvm-commits at cs.uiuc.edu>, "Owen Anderson" <owen at apple.com>
> Sent: Wednesday, January 22, 2014 7:31:36 PM
> Subject: [PATCH] Constant Hoisting Pass
>
>
>
> Hi @ll,
>
> this set of patches add a new pass called constant hoisting to the
> codegen pipeline. The idea behind this pass is to hoist and hide
> expensive constants, which forces them to be live-out/live-in
> of/into the basic block. This is done to work around the
> one-basic-block-a-time approach of SelectionDAG and friends. The
> intention is to prevent materialization of expensive integer
> constants in every single basic block and to keep them instead in
> registers. This pass sounds extremely like a CodeGenPrepare pass,
> but I had to spilt it out into a separate pass that just runs right
> before CodeGenPrepare. The reason for this is the horribly broken
> update code for the dominator tree in CodeGenPrepare. Luckily this
> code is currently dead, because the dominator tree is never
> available during CodeGenPrepare.
>
> This pass will be extremely beneficial for JavaScript code, because
> it uses a lot of 64bit constants. I also tested it with the llvm
> test-suite, but it didn’t show a big change there. Interestingly I
> didn’t see any compile time increase. I actually have a few
> benchmarks that show a decrease in compile time in the 1-2% range,
> but that could also be just noise. Currently this pass will only
> affect X86, because that is the only target that implements the
> required target hooks. Other targets shouldn’t see any change.
>
> The first patch simply updates TargetTransformInfo subclasses with
> the override and final keywords. Interestingly the method
> “finalizePass” is never called nor overrides a method from a base
> class.
>
> The second patch extends TargetTransformInfo with additional target
> hooks for immediate costs, the constant hoisting pass, and the
> extensions to SelectionDAG for opaque constants. More details are in
> the attached patch.
>
> Thanks for any review in advance.
>
> Cheers,
> Juergen
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-commits
mailing list