[PATCH] D18069: Throttling LICM to reduce compile time of Value Propagation and Reg Splitting

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 12 12:09:58 PST 2016


>> Agree that usually we don't try to take register pressure into
>> account
>> in the middle. But there is special case, like llvm interleave in
>> vectorization. I also don't try to get a precise register model to
>> use
>> in middle end. I just want to obviate apparent non-beneficial cases
>> which only increase compile time. That is why I do the throttling in
>> a
>> constrain way -- only on very large loops, only on cheap instruction,
>> and only when reg pressure is high based on estimation.
>
> The problem is not that your restrictions are unreasonable, but that people also *write* code with this problem, and for the same reason you're motivated to restrict LICM, we do a poor job compiling that code too. Improving the backend to handle this situation better fixes both problems, whereas restricting LICM improves only a subset (modulo modeling difficulties and other optimization losses).
>
>  -Hal
>

> The question is whether the compile time increase is due to LICM or caused by inefficiency in other part of the LLVM that gets
> exposed by LICM. If LICM is not the root cause, fixing it here does look like the wrong place (aka, papering over the real
> problem else where).
>
> David

That is true. I acknowledge the root cause of the problem is in Value
Propagation and Reg Splitting algorithm. As Daniel pointed out at the
beginning, doing value propagation in eager way can solve the problem
in value propagation from the root. And gcc's reg splitting algorithm
-- loop based splitting + local splitting doesn't have the compile
time problem we saw in llvm. I already proposed a patch to add loop
based splitting as an enhancement for current region based reg
splitting, but I havn't ventured to remove current region based
splitting because it means a lot of fixing and tuning work and it is
not of high priority.

I can hold the patch, and see if I or somebody else can find some time
to solve the problems in a better way. Fortunately, if with the patch
http://reviews.llvm.org/D18066 in, the compile time problem can be
relieved a lot already.

Thanks to everyone for the helpful discussions.

Regards,
Wei.


More information about the llvm-commits mailing list