[LLVMdev] DependenceAnalysis and PR14241

Preston Briggs preston.briggs at gmail.com
Fri Nov 2 11:40:16 PDT 2012


Here's the current code (abstracted a bit)

    const Instruction *Src,
    const Instruction *Dst,
    // make sure they are loads and stores, then
    const Value *SrcPtr = getPointerOperand(Src); // hides a little
casting, then Src->getPointerOperand
    const Value *DstPtr = getPointerOperand(Dst); // ditto
    // see how underlying objects alias, then
    const GEPOperator *SrcGEP = dyn_cast<GEPOperator>(SrcPtr);
    const GEPOperator *DstGEP = dyn_cast<GEPOperator>(DstPtr);

After that, most everything is done by disassembling the SrcGEP and DstGEP.
The conservative approach would be to make sure SrcPtr and DstPtr are both
loop invariant.

I'm not sure what you're suggesting.  How to I pass one (both?) of these
pointers to SCEV?

Thanks,
Preston





On Fri, Nov 2, 2012 at 11:08 AM, Tobias Grosser <tobias at grosser.es> wrote:

> On 11/02/2012 11:02 AM, Hal Finkel wrote:
>
>> ----- Original Message -----
>>
>>> From: "Tobias Grosser" <tobias at grosser.es>
>>> To: "preston briggs" <preston.briggs at gmail.com>
>>> Cc: "Benjamin Kramer" <benny.kra at gmail.com>, "LLVM Developers Mailing
>>> List" <llvmdev at cs.uiuc.edu>
>>> Sent: Friday, November 2, 2012 12:56:53 PM
>>> Subject: Re: [LLVMdev] DependenceAnalysis and PR14241
>>>
>>> On 11/02/2012 10:21 AM, Preston Briggs wrote:
>>>
>>>>
>>>> My initial guess is that a conservative fix is quick and small
>>>> (make
>>>> sure the underlying pointers are loop invariant, otherwise give
>>>> up). A
>>>> better approach would be to somehow turn code like the example into
>>>> array references that can be analyzed. I'll need to think about
>>>> this and
>>>> do some reading.
>>>>
>>>
>>> Hi Preston,
>>>
>>> I looked at this test case. I am not sure what you are exactly doing,
>>> but I have the feeling you start from the getelementptr instruction.
>>> If
>>> you directly pass the pointer that is pointed to by the loads and
>>> stores
>>> to SCEV, there should just be a single base pointer %s in the
>>> resulting
>>> SCEVS. You can then extract this base pointer, subtract it from the
>>> scev
>>> and analyze the remaining scev as subscript. The base pointer in this
>>> test case is loop invariant.
>>>
>>
>> Does const SCEV *getPointerBase(const SCEV *V) do this?
>>
>
> It give you the base pointer. Yes.
>
> Tobi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121102/4c397b71/attachment.html>


More information about the llvm-dev mailing list