<p dir="ltr">Why not just delete the field instead?</p>
<div class="gmail_quote">On Apr 24, 2016 2:08 AM, "Nick Lewycky via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">nicholas created this revision.<br>
nicholas added a subscriber: llvm-commits.<br>
nicholas set the repository for this revision to rL LLVM.<br>
<br>
PHITransAddr has a TargetLibraryInfo* member which it always sets to nullptr at construction. It has the logic to pass the TLI down to instruction simplify utility functions, but it doesn't take any value from the pass.<br>
<br>
The attached pass simply adds the plumbing to the four callees, three of which have TLIs to pass in.<br>
<br>
There is no testcase included, all the existing tests continue to pass. This change wasn't motivated by any example code, only by the "huh that's funny" of seeing the PHITransAddr constructor always set TLI to nullptr.<br>
<br>
Repository:<br>
rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D19463" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19463</a><br>
<br>
Files:<br>
include/llvm/Analysis/PHITransAddr.h<br>
include/llvm/Transforms/Utils/MemorySSA.h<br>
lib/Analysis/MemoryDependenceAnalysis.cpp<br>
lib/Analysis/PHITransAddr.cpp<br>
lib/Transforms/Scalar/GVN.cpp<br>
<br>
Index: lib/Transforms/Scalar/GVN.cpp<br>
===================================================================<br>
--- lib/Transforms/Scalar/GVN.cpp<br>
+++ lib/Transforms/Scalar/GVN.cpp<br>
@@ -1494,7 +1494,7 @@<br>
// If all preds have a single successor, then we know it is safe to insert<br>
// the load on the pred (?!?), so we can insert code to materialize the<br>
// pointer if it is not available.<br>
- PHITransAddr Address(LI->getPointerOperand(), DL, AC);<br>
+ PHITransAddr Address(LI->getPointerOperand(), DL, TLI, AC);<br>
Value *LoadPtr = nullptr;<br>
LoadPtr = Address.PHITranslateWithInsertion(LoadBB, UnavailablePred,<br>
*DT, NewInsts);<br>
Index: lib/Analysis/MemoryDependenceAnalysis.cpp<br>
===================================================================<br>
--- lib/Analysis/MemoryDependenceAnalysis.cpp<br>
+++ lib/Analysis/MemoryDependenceAnalysis.cpp<br>
@@ -909,7 +909,7 @@<br>
return;<br>
}<br>
const DataLayout &DL = FromBB->getModule()->getDataLayout();<br>
- PHITransAddr Address(const_cast<Value *>(Loc.Ptr), DL, &AC);<br>
+ PHITransAddr Address(const_cast<Value *>(Loc.Ptr), DL, &TLI, &AC);<br>
<br>
// This is the set of blocks we've inspected, and the pointer we consider in<br>
// each block. Because of critical edges, we currently bail out if querying<br>
Index: lib/Analysis/PHITransAddr.cpp<br>
===================================================================<br>
--- lib/Analysis/PHITransAddr.cpp<br>
+++ lib/Analysis/PHITransAddr.cpp<br>
@@ -371,7 +371,7 @@<br>
SmallVectorImpl<Instruction*> &NewInsts) {<br>
// See if we have a version of this value already available and dominating<br>
// PredBB. If so, there is no need to insert a new instance of it.<br>
- PHITransAddr Tmp(InVal, DL, AC);<br>
+ PHITransAddr Tmp(InVal, DL, TLI, AC);<br>
if (!Tmp.PHITranslateValue(CurBB, PredBB, &DT, /*MustDominate=*/true))<br>
return Tmp.getAddr();<br>
<br>
Index: include/llvm/Transforms/Utils/MemorySSA.h<br>
===================================================================<br>
--- include/llvm/Transforms/Utils/MemorySSA.h<br>
+++ include/llvm/Transforms/Utils/MemorySSA.h<br>
@@ -918,7 +918,8 @@<br>
if (WalkingPhi && Location.Ptr) {<br>
PHITransAddr Translator(<br>
const_cast<Value *>(Location.Ptr),<br>
- OriginalAccess->getBlock()->getModule()->getDataLayout(), nullptr);<br>
+ OriginalAccess->getBlock()->getModule()->getDataLayout(), nullptr,<br>
+ nullptr);<br>
if (!Translator.PHITranslateValue(OriginalAccess->getBlock(),<br>
DefIterator.getPhiArgBlock(), nullptr,<br>
false))<br>
Index: include/llvm/Analysis/PHITransAddr.h<br>
===================================================================<br>
--- include/llvm/Analysis/PHITransAddr.h<br>
+++ include/llvm/Analysis/PHITransAddr.h<br>
@@ -50,8 +50,9 @@<br>
SmallVector<Instruction*, 4> InstInputs;<br>
<br>
public:<br>
- PHITransAddr(Value *addr, const DataLayout &DL, AssumptionCache *AC)<br>
- : Addr(addr), DL(DL), TLI(nullptr), AC(AC) {<br>
+ PHITransAddr(Value *addr, const DataLayout &DL, const TargetLibraryInfo *TLI,<br>
+ AssumptionCache *AC)<br>
+ : Addr(addr), DL(DL), TLI(TLI), AC(AC) {<br>
// If the address is an instruction, the whole thing is considered an input.<br>
if (Instruction *I = dyn_cast<Instruction>(Addr))<br>
InstInputs.push_back(I);<br>
<br>
<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div>