[PATCH] D37353: [SparsePropagation] Enable interprocedural analysis
Daniel Berlin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 2 11:38:27 PDT 2017
dberlin added a comment.
It's worth noting: You can make propagation much faster by keeping a separate worklist for overdefined , and prioritizing it over the normal one.
This will move things to overdefined as quickly as possible.
(Because anything meet overdefined is just about always overdefined).
This is what SCCP does.
Again, just recording it here, i can do it in a followup.
================
Comment at: include/llvm/Analysis/SparsePropagation.h:48
+ using LatticeVal = const void *;
+ using StateTy = DenseMap<Value *, LatticeVal>;
----------------
Is this, and the associated changes you make to do the mapping, still needed if lattice values can be something other than void pointers?
================
Comment at: include/llvm/Analysis/SparsePropagation.h:167
+ /// BBWorkList - Holds basic blocks that should be processed.
+ std::vector<BasicBlock *> BBWorkList;
----------------
SmallVector please
================
Comment at: include/llvm/Analysis/SparsePropagation.h:171
+ /// that should be processed.
+ std::vector<Value *> ValueWorkList;
----------------
SmallVector please
================
Comment at: lib/Analysis/SparsePropagation.cpp:58
+SparseSolver::LatticeVal SparseSolver::getValueState(Value *V) const {
+ StateTy::const_iterator I = ValueState.find(V);
+ return I != ValueState.end() ? I->second : LatticeFunc->getUntrackedVal();
----------------
auto
================
Comment at: lib/Analysis/SparsePropagation.cpp:58
+SparseSolver::LatticeVal SparseSolver::getValueState(Value *V) const {
+ StateTy::const_iterator I = ValueState.find(V);
+ return I != ValueState.end() ? I->second : LatticeFunc->getUntrackedVal();
----------------
dberlin wrote:
> auto
Given this occurs so often, can you please just pull it out into a templated helper.
template <class T, class V>
LatticeVal findOrReturnUntracked(T Mapping, V Value)
{
auto I = Mapping.find(V);
return I != Mapping.end() ? I->second : LatticeFunc->getUntrackedVal;
}
or whatever.
================
Comment at: lib/Analysis/SparsePropagation.cpp:64
+SparseSolver::getGlobalVariableState(GlobalVariable *GV) const {
+ StateTy::const_iterator I = GlobalVariableState.find(GV);
+ return I != GlobalVariableState.end() ? I->second
----------------
auto
================
Comment at: lib/Analysis/SparsePropagation.cpp:70
+SparseSolver::LatticeVal SparseSolver::getFunctionState(Function *F) const {
+ StateTy::const_iterator I = FunctionState.find(F);
+ return I != FunctionState.end() ? I->second : LatticeFunc->getUntrackedVal();
----------------
auto
https://reviews.llvm.org/D37353
More information about the llvm-commits
mailing list