<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Apr 18, 2013, at 6:42 AM, Hal Finkel <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">----- Original Message -----<br><blockquote type="cite">From: "Andrew Trick" <<a href="mailto:atrick@apple.com">atrick@apple.com</a>><br>To: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>><br>Cc: "Jonas Paulsson" <<a href="mailto:jonas.paulsson@ericsson.com">jonas.paulsson@ericsson.com</a>>, <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>Sent: Thursday, April 18, 2013 2:33:52 AM<br>Subject: Re: [LLVMdev] alias analysis in backend<br><br><br>On Apr 17, 2013, at 2:33 AM, Hal Finkel <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>> wrote:<br><br><blockquote type="cite">----- Original Message -----<br><blockquote type="cite">From: "Jonas Paulsson" <<a href="mailto:jonas.paulsson@ericsson.com">jonas.paulsson@ericsson.com</a>><br>To: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>><br>Cc: <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>Sent: Wednesday, April 17, 2013 12:22:49 AM<br>Subject: RE: [LLVMdev] alias analysis in backend<br><br>Hi Hal,<br><br>Thanks. How about a symbol with two different immediate offsets -<br>the<br>Value* would be the same, right? I don't see how<br>AliasAnalysis::Location would handle this... And<br>BasicAliasAnalysis<br>does<br><br>if (V1 == V2) return MustAlias;<br><br>, so I'm not sure how this would be done .. ?<br></blockquote><br>If you run with -enable-misched -enable-aa-sched-mi<br><br>then you'll get this logic from the end of MIsNeedChainEdge:<br><br>// The following interface to AA is fashioned after<br>DAGCombiner::isAlias<br>// and operates with MachineMemOperand offset with some important<br>// assumptions:<br>//   - LLVM fundamentally assumes flat address spaces.<br>//   - MachineOperand offset can *only* result from legalization<br>and<br>//     cannot affect queries other than the trivial case of<br>overlap<br>//     checking.<br>//   - These offsets never wrap and never step outside<br>//     of allocated objects.<br>//   - There should never be any negative offsets here.<br>//<br>...<br><br>int64_t MinOffset = std::min(MMOa->getOffset(),<br>MMOb->getOffset());<br>int64_t Overlapa = MMOa->getSize() + MMOa->getOffset() -<br>MinOffset;<br>int64_t Overlapb = MMOb->getSize() + MMOb->getOffset() -<br>MinOffset;<br><br>AliasAnalysis::AliasResult AAResult = AA->alias(<br>AliasAnalysis::Location(MMOa->getValue(), Overlapa,<br>                        MMOa->getTBAAInfo()),<br>AliasAnalysis::Location(MMOb->getValue(), Overlapb,<br>                        MMOb->getTBAAInfo()));<br><br>return (AAResult != AliasAnalysis::NoAlias);<br></blockquote><br>This conservatively compensates for loads/stores that were split into<br>narrower accesses during lowering, so doesn't help Jonas.<br><br>The MachineMemOperand offset is used differently for<br>FixedFrameIndices, but we don't currently special case it here to<br>disambiguate them.<br></blockquote><br>Thanks, I did not understand that. I thought that each different stack slot had its own frame index, or does that only apply to callee-saved and spill slots?<br></div></blockquote><div><br></div>They certainly have their own index. I think the question is where we disambiguate those slots.<br><div><br></div><div>I know others have worked on the inverse of this problem (PR12205). Akira? They may remember the details.</div><div><br></div><div>I don't normally see raw frame or stack indices since I'm scheduling before regalloc and PEI. Things from the stack are usually arguments or allocas, so they naturally have distinct values.</div><div><br></div><div>Jonas, it might help to post a test case and/or file a bug.</div><div><br></div><div>-Andy</div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite">The general problem is that we don't have a<br>CodeGen-level alias analysis API yet. It looks like this particular<br>case could be fixed with an easy patch though, unless I'm missing<br>something.<br><br>-Andy<br><br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">-----Original Message-----<br>From: Hal Finkel [<a href="mailto:hfinkel@anl.gov">mailto:hfinkel@anl.gov</a>]<br>Sent: Tuesday, April 16, 2013 7:35 PM<br>To: Jonas Paulsson<br>Cc: <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>Subject: Re: [LLVMdev] alias analysis in backend<br><br>----- Original Message -----<br><blockquote type="cite">From: "Jonas Paulsson" <<a href="mailto:jonas.paulsson@ericsson.com">jonas.paulsson@ericsson.com</a>><br>To: <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>Sent: Tuesday, April 16, 2013 11:24:36 AM<br>Subject: [LLVMdev] alias analysis in backend<br><br><br><br><br><br>Hi,<br><br><br><br>I would like to implement alias analysis in my backend. I would<br>like<br>to for example get the result that two stack-accesses with<br>different<br>offsets (indexes), would return noAlias. However, I'm somewhat<br>confused as there is no notion of offset for the Location<br>object.<br><br><br><br>I would also like to call ScheduleDAGInstr::buildSchedGraph()<br>with<br>this AliasAnalysis and have MIsNeedsChainEdge() return false in<br>this<br>case.<br><br><br><br>What should I do? Adding a MemoryOperand to such an instruction<br>seems<br>right, but it doesn't seem to fit quite. What Value would be<br>referenced?<br></blockquote><br>I think that they should have pseudo-source values, see:<br>include/llvm/CodeGen/PseudoSourceValue.h<br><br>I was under the impression that different pseudo source values<br>from<br>different frame indices already have this no-alias property. If<br>they<br>don't, then this seems like a nice general improvement that would<br>benefit<br>all backends.<br><br>-Hal<br><br><blockquote type="cite">BasicAliasAnalysis returns MustAlias for the same Value,<br>e g 'Stack'.<br><br><br><br>Should I implement a target AliasAnalysis, perhaps derived from<br>BasicAliasAnalysis, and make it required for my pass that will<br>be<br>using it?<br><br><br><br>If not, could I make this work with BasicAliasAnalysis by adding<br>the<br>right memory operands?<br><br><br><br>Thanks,<br><br><br><br>Jonas Paulsson<br><br><br><br><br><br><br>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br><br></blockquote></blockquote><br></blockquote>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></blockquote></blockquote></div></blockquote></div><br></body></html>