[PATCH] D49108: [CVP] Handle instructions with no user. No need to create CVPLattice state. This handles terminator instructions and more.
Xin Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 9 16:47:20 PDT 2018
trentxintong created this revision.
trentxintong added reviewers: davide, mssimpso.
I tested this pass by concatenating all the code from the
llvm/lib/Analysis/ folder and do clang -g followed by opt
(~/llvmoss/build/bin/opt -called-value-propagation analysis.dbg.ll
-time-passes -f -o out). I get
~7% speedup for the pass. I expect some of the gain come from skipping terminator
instructions.
I did not run CTMark, because I do not expect this to show up measureably
in the benchmark.
Before patch:
=============
-------------------------------------------------------------------------
-------------------------------------------------------------------------
... Pass execution timing report ...
-------------------------------------------------------------------------
-------------------------------------------------------------------------
Total Execution Time: 3.5970 seconds (3.5957 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time---
- Name --- 2.0163 ( 59.2%) 0.1050 ( 54.8%) 2.1212 ( 59.0%) 2.1213 ( 59.0%)
Bitcode Writer
0.6797 ( 20.0%) 0.0595 ( 31.1%) 0.7391 ( 20.5%) 0.7378 ( 20.5%)
Module Verifier
0.7096 ( 20.8%) 0.0270 ( 14.1%) 0.7366 ( 20.5%) 0.7366 ( 20.5%)
Called Value Propagation
3.4056 (100.0%) 0.1914 (100.0%) 3.5970 (100.0%) 3.5957 (100.0%)
Total
After patch:
============
-------------------------------------------------------------------------
-------------------------------------------------------------------------
... Pass execution timing report ...
-------------------------------------------------------------------------
-------------------------------------------------------------------------
Total Execution Time: 3.4911 seconds (3.4896 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time---
- Name --- 1.9794 ( 59.9%) 0.1050 ( 56.0%) 2.0844 ( 59.7%) 2.0844 ( 59.7%)
Bitcode Writer
0.6717 ( 20.3%) 0.0546 ( 29.1%) 0.7263 ( 20.8%) 0.7247 ( 20.8%)
Module Verifier
0.6525 ( 19.8%) 0.0280 ( 14.9%) 0.6804 ( 19.5%) 0.6805 ( 19.5%)
Called Value Propagation
3.3036 (100.0%) 0.1876 (100.0%) 3.4911 (100.0%) 3.4896 (100.0%)
Total
Repository:
rL LLVM
https://reviews.llvm.org/D49108
Files:
lib/Transforms/IPO/CalledValuePropagation.cpp
Index: lib/Transforms/IPO/CalledValuePropagation.cpp
===================================================================
--- lib/Transforms/IPO/CalledValuePropagation.cpp
+++ lib/Transforms/IPO/CalledValuePropagation.cpp
@@ -345,6 +345,9 @@
void visitInst(Instruction &I,
DenseMap<CVPLatticeKey, CVPLatticeVal> &ChangedValues,
SparseSolver<CVPLatticeKey, CVPLatticeVal> &SS) {
+ // Simply bail if this instruction has no user.
+ if (I.use_empty())
+ return;
auto RegI = CVPLatticeKey(&I, IPOGrouping::Register);
ChangedValues[RegI] = getOverdefinedVal();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49108.154732.patch
Type: text/x-patch
Size: 620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180709/a93693ae/attachment.bin>
More information about the llvm-commits
mailing list