[PATCH] D19821: [EarlyCSE] Use MemorySSA if available.

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 21 08:33:50 PDT 2016


Ugh, hit send too early:


On Sun, Aug 21, 2016 at 8:32 AM, Daniel Berlin <dberlin at dberlin.org> wrote:

>
>
> On Sat, Aug 20, 2016 at 4:01 PM, Philip Reames <listmail at philipreames.com>
> wrote:
>
>> reames added a comment.
>>
>> Sorry for not responding to this for so long.
>>
>> My objection is primarily from a compile time concern.  Right now,
>> EarlyCSE is a *very* cheap pass to run.  If you can keep it fast (even when
>> we have to reconstruct MemorySSA) I don't object to having EarlyCSE
>> MemorySSA based.  I think that is a very hard bar to pass in practice.  In
>> particular, the bar is not total O3 time.  It's EarlyCSE time.
>
>
> The current time to construct MemorySSA is basically nothing, even on
> large and absurd testcases.
> You can't make it *zero* because it does an extra extra instruction walk
> or two over EarlyCSE.
> But if you want is fast, EarlyCSE is the fastest pass, even on large and
> absurd testcases i can find.
> It doesn't change after this patch AFAICT.
>
> I disabled LICM, since on this testcase takes over 100 seconds to do LICM.
>
> Example at O2:
>

That was really O1.
Here is O2:
===-------------------------------------------------------------------------===
                      ... Pass execution timing report ...
===-------------------------------------------------------------------------===
  Total Execution Time: 47.8836 seconds (47.9724 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---
 --- Name ---
   7.8417 ( 16.6%)   0.0162 (  2.2%)   7.8579 ( 16.4%)   7.8751 ( 16.4%)
 Loop-Closed SSA Form Pass
   4.9817 ( 10.6%)   0.0469 (  6.4%)   5.0286 ( 10.5%)   5.0347 ( 10.5%)
 Global Value Numbering
   4.9904 ( 10.6%)   0.0133 (  1.8%)   5.0037 ( 10.4%)   5.0127 ( 10.4%)
 Value Propagation
   4.1806 (  8.9%)   0.0101 (  1.4%)   4.1907 (  8.8%)   4.1995 (  8.8%)
 Loop-Closed SSA Form Pass
   3.5075 (  7.4%)   0.0045 (  0.6%)   3.5121 (  7.3%)   3.5155 (  7.3%)
 Value Propagation
   2.1602 (  4.6%)   0.3293 ( 44.8%)   2.4895 (  5.2%)   2.4905 (  5.2%)
 Loop Load Elimination
   2.2176 (  4.7%)   0.0254 (  3.5%)   2.2430 (  4.7%)   2.2581 (  4.7%)
 Combine redundant instructions
   2.1154 (  4.5%)   0.0047 (  0.6%)   2.1201 (  4.4%)   2.1226 (  4.4%)
 Dead Store Elimination
   1.8411 (  3.9%)   0.0125 (  1.7%)   1.8536 (  3.9%)   1.8539 (  3.9%)
 Combine redundant instructions
   1.8317 (  3.9%)   0.0032 (  0.4%)   1.8349 (  3.8%)   1.8388 (  3.8%)
 Loop-Closed SSA Form Pass
   1.6531 (  3.5%)   0.0028 (  0.4%)   1.6559 (  3.5%)   1.6578 (  3.5%)
 Loop-Closed SSA Form Pass
   1.1995 (  2.5%)   0.0123 (  1.7%)   1.2117 (  2.5%)   1.2166 (  2.5%)
 Combine redundant instructions
   1.0155 (  2.2%)   0.0122 (  1.7%)   1.0278 (  2.1%)   1.0295 (  2.1%)
 Combine redundant instructions
   0.9646 (  2.0%)   0.0118 (  1.6%)   0.9763 (  2.0%)   0.9791 (  2.0%)
 Combine redundant instructions
   0.9608 (  2.0%)   0.0131 (  1.8%)   0.9739 (  2.0%)   0.9744 (  2.0%)
 Combine redundant instructions
   0.9566 (  2.0%)   0.0126 (  1.7%)   0.9692 (  2.0%)   0.9704 (  2.0%)
 Combine redundant instructions
   0.9193 (  1.9%)   0.0277 (  3.8%)   0.9470 (  2.0%)   0.9493 (  2.0%)
 SLP Vectorizer
   0.7629 (  1.6%)   0.0059 (  0.8%)   0.7688 (  1.6%)   0.7699 (  1.6%)
 Induction Variable Simplification
   0.4903 (  1.0%)   0.0035 (  0.5%)   0.4938 (  1.0%)   0.4945 (  1.0%)
 Combine redundant instructions
   0.2662 (  0.6%)   0.0156 (  2.1%)   0.2817 (  0.6%)   0.2817 (  0.6%)
 Early GVN Hoisting of Expressions
   0.2193 (  0.5%)   0.0037 (  0.5%)   0.2230 (  0.5%)   0.2259 (  0.5%)
 Early CSE
   0.2127 (  0.5%)   0.0015 (  0.2%)   0.2141 (  0.4%)   0.2142 (  0.4%)
 Early CSE
   0.2004 (  0.4%)   0.0032 (  0.4%)   0.2036 (  0.4%)   0.2035 (  0.4%)
 Early CSE


Note the GVN and EarlyCSE times includes a full build of MemorySSA because
> of where the passes are run.
>
>
> I fully expect that the more precise analysis may speed up other passes,
>> but we can't assume that happens for all inputs.  (As I write this, I'm
>> recognizing that this might be too high a bar to set.  If you think I'm
>> being unreasonable, argue why and what a better line should be.)
>>
>> Given I'm not going to have time to be active involved in this thread,
>> I'm going to defer to other reviewers.  If they think this is a good idea,
>> I will not actively block the thread.
>>
>>
>> https://reviews.llvm.org/D19821
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160821/02dd463f/attachment.html>


More information about the llvm-commits mailing list