[PATCH] D49078: [CVP] Handle calls with void return value. No need to create CVPLattice state for it.

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 9 07:33:38 PDT 2018


trentxintong created this revision.
trentxintong added reviewers: davide, mssimpso.

Tests: 10
Metric: compile_time

Program                                         unpatch-result  patch-result diff

   

Bullet/bullet                                  32.39           30.54        -5.7%
SPASS/SPASS                                    18.14           17.25        -4.9%
mafft/pairlocalalign                           12.10           11.64        -3.8%
ClamAV/clamscan                                19.21           19.63         2.2%
7zip/7zip-benchmark                            49.55           48.85        -1.4%
kimwitu++/kc                                   15.68           15.87         1.2%
lencod/lencod                                  21.13           21.34         1.0%
consumer-typeset/consumer-typeset              13.65           13.62        -0.2%
tramp3d-v4/tramp3d-v4                          29.88           29.92         0.1%
sqlite3/sqlite3                                18.48           18.46        -0.1%

  unpatch-result  patch-result       diff

count  10.000000       10.000000     10.000000
mean   23.022000       22.712400    -0.011671 
std    11.362831       11.094183     0.027338 
min    12.104000       11.640000    -0.057298 
25%    16.299000       16.214000    -0.032282 
50%    18.844000       19.048000    -0.001350 
75%    27.689000       27.774000     0.007752 
max    49.552000       48.852000     0.021861

I also tested only this pass by concatenating all the code from the
llvm/lib/Analysis/ folder and do clang -g followed by opt. I get close to 20% speedup
for the pass. I expect a majority of the gain come from skipping the dbg intrinsics.

Before patch (opt -time-passes -called-value-propagation):
==========================================================

-------------------------------------------------------------------------
-------------------------------------------------------------------------

... Pass execution timing report ...
====================================

Total Execution Time: 3.8303 seconds (3.8279 wall clock)

---User Time--- --System Time-- --User+System-- ---Wall Time--- ---
Name ---
 2.0768 ( 57.3%) 0.0990 ( 48.0%) 2.1757 ( 56.8%) 2.1757 ( 56.8%) Bitcode
Writer
 0.8444 ( 23.3%) 0.0600 ( 29.1%) 0.9044 ( 23.6%) 0.9044 ( 23.6%) Called
Value Propagation
 0.7031 ( 19.4%) 0.0472 ( 22.9%) 0.7502 ( 19.6%) 0.7478 ( 19.5%) Module
Verifier
 3.6242 (100.0%) 0.2062 (100.0%) 3.8303 (100.0%) 3.8279 (100.0%) Total

After patch (opt -time-passes -called-value-propagation):
=========================================================

-------------------------------------------------------------------------
-------------------------------------------------------------------------

... Pass execution timing report ...
====================================

Total Execution Time: 3.6605 seconds (3.6579 wall clock)

---User Time--- --System Time-- --User+System-- ---Wall Time--- ---
Name ---
 2.0716 ( 59.7%) 0.0990 ( 52.5%) 2.1705 ( 59.3%) 2.1706 ( 59.3%) Bitcode
Writer
 0.7144 ( 20.6%) 0.0300 ( 15.9%) 0.7444 ( 20.3%) 0.7444 ( 20.4%) Called
Value Propagation
 0.6859 ( 19.8%) 0.0596 ( 31.6%) 0.7455 ( 20.4%) 0.7429 ( 20.3%) Module
Verifier
 3.4719 (100.0%) 0.1886 (100.0%) 3.6605 (100.0%) 3.6579 (100.0%) Total


Repository:
  rL LLVM

https://reviews.llvm.org/D49078

Files:
  lib/Transforms/IPO/CalledValuePropagation.cpp


Index: lib/Transforms/IPO/CalledValuePropagation.cpp
===================================================================
--- lib/Transforms/IPO/CalledValuePropagation.cpp
+++ lib/Transforms/IPO/CalledValuePropagation.cpp
@@ -268,6 +268,9 @@
 
     // If we can't track the function's return values, there's nothing to do.
     if (!F || !canTrackReturnsInterprocedurally(F)) {
+      // Void return, just bail.
+      if (I->getType()->isVoidTy())
+        return;
       ChangedValues[RegI] = getOverdefinedVal();
       return;
     }
@@ -283,6 +286,11 @@
       ChangedValues[RegFormal] =
           MergeValues(SS.getValueState(RegFormal), SS.getValueState(RegActual));
     }
+
+    // Void return, just bail.
+    if (I->getType()->isVoidTy())
+      return;
+
     ChangedValues[RegI] =
         MergeValues(SS.getValueState(RegI), SS.getValueState(RetF));
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49078.154601.patch
Type: text/x-patch
Size: 869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180709/73011209/attachment.bin>


More information about the llvm-commits mailing list