<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 3, 2016 at 5:04 PM, George Burgess IV <span dir="ltr"><<a href="mailto:george.burgess.iv@gmail.com" target="_blank">george.burgess.iv@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div>> <span style="font-size:12.8px">First, it looks like your attempt to add basicAA in setupAnalyses is not doing anything</span><br></div><div><span style="font-size:12.8px"><br></span></div></span><div><span style="font-size:12.8px">r283158 should fix that -- thanks.</span></div><span class=""><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">> </span><span style="font-size:12.8px">We have no way to catch all the Use.set's that i can find</span></div><div><span style="font-size:12.8px"><br></span></div></span><div><span style="font-size:12.8px">Can we keep an `OldDef` member that tracks the ID of the Def/Phi we last optimized to?</span></div></div></blockquote><div><br></div><div>So then isOptimized is "OldDef == Def"?<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="font-size:12.8px"> It makes isOptimized() a bit more expensive, but I can't think of a valid transformation that swaps the DefiningAccess of Foo from Bar to Baz to Bar while making Bar not the clobber for Foo.</span></div></div></blockquote><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 2, 2016 at 8:21 PM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sigh.<div><br></div><div>Two things need your thoughts on george.</div><div><br></div><div>First, it looks like your attempt to add basicAA in setupAnalyses is not doing anything:</div><div><div> 76  <span class="m_6835407862127703493m_7333553457511032516m_-6263984207955091692m_-5683084899802274570m_-7342551488711045549m_8978184054473801603m_3617730738384645345gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>AliasResult AAResults::alias(const MemoryLocation &LocA,</div><div>   77  <span class="m_6835407862127703493m_7333553457511032516m_-6263984207955091692m_-5683084899802274570m_-7342551488711045549m_8978184054473801603m_3617730738384645345gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>                             const MemoryLocation &LocB) {</div><div>-> 78  <span class="m_6835407862127703493m_7333553457511032516m_-6263984207955091692m_-5683084899802274570m_-7342551488711045549m_8978184054473801603m_3617730738384645345gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>  for (const auto &AA : AAs) {</div><div>   79  <span class="m_6835407862127703493m_7333553457511032516m_-6263984207955091692m_-5683084899802274570m_-7342551488711045549m_8978184054473801603m_3617730738384645345gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>    auto Result = AA->alias(LocA, LocB);</div><div>   80  <span class="m_6835407862127703493m_7333553457511032516m_-6263984207955091692m_-5683084899802274570m_-7342551488711045549m_8978184054473801603m_3617730738384645345gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>    if (Result != MayAlias)</div><div>   81  <span class="m_6835407862127703493m_7333553457511032516m_-6263984207955091692m_-5683084899802274570m_-7342551488711045549m_8978184054473801603m_3617730738384645345gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>      return Result;</div><div>(lldb) p AAs</div></div><div>(std::__1::vector<std::__1::un<wbr>ique_ptr<llvm::AAResults::Conc<wbr>ept, std::__1::default_delete<llvm:<wbr>:AAResults::Concept> >, std::__1::allocator<std::__1::<wbr>unique_ptr<llvm::AAResults::Co<wbr>ncept, std::__1::default_delete<llvm:<wbr>:AAResults::Concept> > > >) $33 = size=0 {}<br></div><div><br></div><div><br></div><div><br></div><div>Simple way to see this:<br><br></div><div>In the unit test, the following:</div><div><div>  Type *Int8 = Type::getInt8Ty(C);</div><div>  Value *AllocaA = B.CreateAlloca(Int8, ConstantInt::get(Int8, 1), "A");</div><div>  Instruction *SIA = B.CreateStore(ConstantInt::get<wbr>(Int8, 0), AllocaA);</div><div>  Value *AllocaB = B.CreateAlloca(Int8, ConstantInt::get(Int8, 1), "B");</div><div>  Instruction *SIB = B.CreateStore(ConstantInt::get<wbr>(Int8, 0), AllocaB);</div><div>  Instruction *LIA = B.CreateLoad(AllocaA);</div></div><div><br></div><div>results in:<br><div>define void @F() {</div><div>  %A = alloca i8, i8 1</div><div>; 1 = MemoryDef(liveOnEntry)</div><div>  store i8 0, i8* %A</div><div>  %B = alloca i8, i8 1</div><div>; 2 = MemoryDef(1)</div><div>  store i8 0, i8* %B</div><div>; MemoryUse(2)</div><div>  %1 = load i8, i8* %A</div><div>}</div></div><div><br></div><div>(The load is not being optimized because there is no AA).</div><div><br></div><div>Second, we can only reset optimized properly if all operand setting is done through setDefinedAccess.</div><div><br></div><div>We have no way to catch all the Use.set's that i can find.</div><div><br></div><div>If that's correct, i'll drop the optimized flag, and just keep the part to reset setDefiningAccess.</div><div><br></div><div>This means we will still pay a cost for calling getclobberingmemoryaccess on loads.</div><div><br></div></div><div class="m_6835407862127703493m_7333553457511032516m_-6263984207955091692m_-5683084899802274570m_-7342551488711045549m_8978184054473801603HOEnZb"><div class="m_6835407862127703493m_7333553457511032516m_-6263984207955091692m_-5683084899802274570m_-7342551488711045549m_8978184054473801603h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 2, 2016 at 7:39 PM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">dberlin added a comment.<br>
<br>
(Unittest that resets the defining access, and calls getClobberingAccess, coming)<br>
<br>
<br>
<a href="https://reviews.llvm.org/D25172" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2517<wbr>2</a><br>
<br>
<br>
<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>