diff options
author | Bob Wilson <bob.wilson@apple.com> | 2010-02-24 01:39:00 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2010-02-24 01:39:00 +0000 |
commit | 9d2ed8e632b71914b2a668932f4f49b87c3ca0b1 (patch) | |
tree | 509e863adc4d263f96df159cd8139d372dc1cb7f /include/llvm/Analysis/PHITransAddr.h | |
parent | c3027f769a7a7479f3c24537d9d525edd83e90b1 (diff) | |
download | llvm-9d2ed8e632b71914b2a668932f4f49b87c3ca0b1.tar.gz llvm-9d2ed8e632b71914b2a668932f4f49b87c3ca0b1.tar.bz2 llvm-9d2ed8e632b71914b2a668932f4f49b87c3ca0b1.tar.xz |
Add an argument to PHITranslateValue to specify the DominatorTree. If this
argument is non-null, pass it along to PHITranslateSubExpr so that it can
prefer using existing values that dominate the PredBB, instead of just
blindly picking the first equivalent value that it finds on a uselist.
Also when the DominatorTree is specified, have PHITranslateValue filter
out any result that does not dominate the PredBB. This is basically just
refactoring the check that used to be in GetAvailablePHITranslatedSubExpr
and also in GVN.
Despite my initial expectations, this change does not affect the results
of GVN for any testcases that I could find, but it should help compile time.
Before this change, if PHITranslateSubExpr picked a value that does not
dominate, PHITranslateWithInsertion would then insert a new value, which GVN
would later determine to be redundant and would replace. By picking a good
value to begin with, we save GVN the extra work of inserting and then
replacing a new value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/PHITransAddr.h')
-rw-r--r-- | include/llvm/Analysis/PHITransAddr.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/include/llvm/Analysis/PHITransAddr.h b/include/llvm/Analysis/PHITransAddr.h index b612316057..033efba3e7 100644 --- a/include/llvm/Analysis/PHITransAddr.h +++ b/include/llvm/Analysis/PHITransAddr.h @@ -66,9 +66,11 @@ public: bool IsPotentiallyPHITranslatable() const; /// PHITranslateValue - PHI translate the current address up the CFG from - /// CurBB to Pred, updating our state the reflect any needed changes. This - /// returns true on failure and sets Addr to null. - bool PHITranslateValue(BasicBlock *CurBB, BasicBlock *PredBB); + /// CurBB to Pred, updating our state to reflect any needed changes. If the + /// dominator tree DT is non-null, the translated value must dominate + /// PredBB. This returns true on failure and sets Addr to null. + bool PHITranslateValue(BasicBlock *CurBB, BasicBlock *PredBB, + const DominatorTree *DT); /// PHITranslateWithInsertion - PHI translate this value into the specified /// predecessor block, inserting a computation of the value if it is @@ -88,14 +90,8 @@ public: /// returns false. bool Verify() const; private: - Value *PHITranslateSubExpr(Value *V, BasicBlock *CurBB, BasicBlock *PredBB); - - - /// GetAvailablePHITranslatedSubExpr - Return the value computed by - /// PHITranslateSubExpr if it dominates PredBB, otherwise return null. - Value *GetAvailablePHITranslatedSubExpr(Value *V, - BasicBlock *CurBB, BasicBlock *PredBB, - const DominatorTree &DT) const; + Value *PHITranslateSubExpr(Value *V, BasicBlock *CurBB, BasicBlock *PredBB, + const DominatorTree *DT); /// InsertPHITranslatedSubExpr - Insert a computation of the PHI translated /// version of 'V' for the edge PredBB->CurBB into the end of the PredBB |