Here's the current code (abstracted a bit)<div><br></div><div><div>    const Instruction *Src,</div><div>    const Instruction *Dst,</div></div><div>    // make sure they are loads and stores, then</div><div><div>    const Value *SrcPtr = getPointerOperand(Src); // hides a little casting, then Src->getPointerOperand</div>
<div>    const Value *DstPtr = getPointerOperand(Dst); // ditto</div></div><div>    // see how underlying objects alias, then</div><div><div>    const GEPOperator *SrcGEP = dyn_cast<GEPOperator>(SrcPtr);</div><div>    const GEPOperator *DstGEP = dyn_cast<GEPOperator>(DstPtr);</div>
</div><div><br></div><div>After that, most everything is done by disassembling the SrcGEP and DstGEP.</div><div>The conservative approach would be to make sure SrcPtr and DstPtr are both loop invariant.</div><div><br></div>
<div>I'm not sure what you're suggesting.  How to I pass one (both?) of these pointers to SCEV?</div><div><br></div><div>Thanks,</div><div>Preston</div><div><br></div><div><br></div><div><br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Nov 2, 2012 at 11:08 AM, Tobias Grosser <span dir="ltr"><<a href="mailto:tobias@grosser.es" target="_blank">tobias@grosser.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 11/02/2012 11:02 AM, Hal Finkel wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
----- Original Message -----<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: "Tobias Grosser" <<a href="mailto:tobias@grosser.es" target="_blank">tobias@grosser.es</a>><br>
To: "preston briggs" <<a href="mailto:preston.briggs@gmail.com" target="_blank">preston.briggs@gmail.com</a>><br>
Cc: "Benjamin Kramer" <<a href="mailto:benny.kra@gmail.com" target="_blank">benny.kra@gmail.com</a>>, "LLVM Developers Mailing List" <<a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">llvmdev@cs.uiuc.edu</a>><br>

Sent: Friday, November 2, 2012 12:56:53 PM<br>
Subject: Re: [LLVMdev] DependenceAnalysis and PR14241<br>
<br>
On 11/02/2012 10:21 AM, Preston Briggs wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
My initial guess is that a conservative fix is quick and small<br>
(make<br>
sure the underlying pointers are loop invariant, otherwise give<br>
up). A<br>
better approach would be to somehow turn code like the example into<br>
array references that can be analyzed. I'll need to think about<br>
this and<br>
do some reading.<br>
</blockquote>
<br>
Hi Preston,<br>
<br>
I looked at this test case. I am not sure what you are exactly doing,<br>
but I have the feeling you start from the getelementptr instruction.<br>
If<br>
you directly pass the pointer that is pointed to by the loads and<br>
stores<br>
to SCEV, there should just be a single base pointer %s in the<br>
resulting<br>
SCEVS. You can then extract this base pointer, subtract it from the<br>
scev<br>
and analyze the remaining scev as subscript. The base pointer in this<br>
test case is loop invariant.<br>
</blockquote>
<br>
Does const SCEV *getPointerBase(const SCEV *V) do this?<br>
</blockquote>
<br></div></div>
It give you the base pointer. Yes.<br>
<br>
Tobi<br>
</blockquote></div><br></div>