[PATCH] D84181: [NFC][GVN] Rewrite IsValueFullyAvailableInBlock()

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 02:32:07 PDT 2020


lebedev.ri added a comment.

In D84181#2163120 <https://reviews.llvm.org/D84181#2163120>, @nikic wrote:

> > While this doesn't appear to help with the perf issue being exposed by D84108 <https://reviews.llvm.org/D84108>, the function as-is is very weird, convoluted, and what's worse, recursive.
>
> Would it be possible to share the pre-GVN IR for the problematic case? (Independently of this cleanup, just curious)


I don't have any particular problematic case in mind, but here's pre-GVN (i disabled all passes in pipeline starting with GVN)
`llvm-test-suite/MultiSource/Applications/JM/lencod/context_ini.c` (produced with D84108 <https://reviews.llvm.org/D84108>)
F12379117: lencod-context_ini-pre-gvn.ll.xz <https://reviews.llvm.org/F12379117>

>> But i'm not sure instructions is *really* the right metric here, Because task-clock stat really improved, by -1.5% .. -5% all across the board.
> 
> This is just (very large) noise. I've added a disclaimer to the page that the task-clock/wall-time results are best ignored.

And here's standalone results:

  y$ perf stat --repeat=100 /builddirs/llvm-project/build-Clang10-Release/bin/opt-old /tmp/lencod-context_ini-pre-gvn.bc -o /dev/null -gvn ; perf stat --repeat=100 /builddirs/llvm-project/build-Clang10-Release/bin/opt /tmp/lencod-context_ini-pre-gvn.bc -o /dev/null -gvn
  
   Performance counter stats for '/builddirs/llvm-project/build-Clang10-Release/bin/opt-old /tmp/lencod-context_ini-pre-gvn.bc -o /dev/null -gvn' (100 runs):
  
              795.35 msec task-clock                #    0.999 CPUs utilized            ( +-  0.04% )
                   3      context-switches          #    0.004 K/sec                    ( +-  4.66% )
                   0      cpu-migrations            #    0.000 K/sec                  
                2723      page-faults               #    0.003 M/sec                    ( +-  0.23% )
          3186511786      cycles                    #    4.006 GHz                      ( +-  0.04% )  (83.20%)
           522856359      stalled-cycles-frontend   #   16.41% frontend cycles idle     ( +-  0.09% )  (83.36%)
           956532477      stalled-cycles-backend    #   30.02% backend cycles idle      ( +-  0.11% )  (33.44%)
          2668685815      instructions              #    0.84  insn per cycle         
                                                    #    0.36  stalled cycles per insn  ( +-  0.04% )  (50.05%)
           514286258      branches                  #  646.619 M/sec                    ( +-  0.03% )  (66.64%)
            19609714      branch-misses             #    3.81% of all branches          ( +-  0.06% )  (83.24%)
  
            0.795919 +- 0.000313 seconds time elapsed  ( +-  0.04% )
  
  
   Performance counter stats for '/builddirs/llvm-project/build-Clang10-Release/bin/opt /tmp/lencod-context_ini-pre-gvn.bc -o /dev/null -gvn' (100 runs):
  
              787.80 msec task-clock                #    0.999 CPUs utilized            ( +-  0.04% )
                   3      context-switches          #    0.003 K/sec                    ( +-  6.11% )
                   0      cpu-migrations            #    0.000 K/sec                    ( +- 70.35% )
                2703      page-faults               #    0.003 M/sec                    ( +-  0.20% )
          3156293784      cycles                    #    4.006 GHz                      ( +-  0.04% )  (83.23%)
           520963102      stalled-cycles-frontend   #   16.51% frontend cycles idle     ( +-  0.09% )  (83.24%)
           931974714      stalled-cycles-backend    #   29.53% backend cycles idle      ( +-  0.14% )  (33.52%)
          2681503031      instructions              #    0.85  insn per cycle         
                                                    #    0.35  stalled cycles per insn  ( +-  0.05% )  (50.28%)
           515472885      branches                  #  654.318 M/sec                    ( +-  0.03% )  (66.96%)
            18427045      branch-misses             #    3.57% of all branches          ( +-  0.08% )  (83.43%)
  
            0.788365 +- 0.000320 seconds time elapsed  ( +-  0.04% )

So there it's an improvement of -0.949% +- 0.04% <https://www.av8n.com/physics/uncertainty-calculator.html?setv=x,0.795919,0.000313&setv=y,0.788365,0.000320&setv=tform,100*((y-x)%2Fx)&go>


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84181/new/

https://reviews.llvm.org/D84181





More information about the llvm-commits mailing list