[LLVMdev] alias result

Hal Finkel hfinkel at anl.gov
Mon Feb 16 11:42:29 PST 2015


----- Original Message -----
> From: "Haopeng Liu" <hyliuhp at gmail.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: llvmdev at cs.uiuc.edu
> Sent: Monday, February 16, 2015 1:38:40 PM
> Subject: Re: [LLVMdev] alias result
> 
> Yes, in my example, %1 and %2 point to t. %3 points to t2.
> 
> But t and t2 point to the same var, is it? That's where I'm confused.

So you believe that:
> >>>> (1): store i64* %thd, i64** %t, align 8    //int64 *t = &thd;
...
> >>>> (3): store i64* %1, i64** %t2, align 8     //int64 *t2 = t;

calling AA.getLocation on these two instructions, and then calling alias on them should not return NoAlias? I think your confusion is regarding what getLocation does. It is not referring to the stored value, but the location where those values are being stored (%t and %t2 in this case). Those won't alias, because %t and %t2 point to disjoint local stack locations.

 -Hal

> 
> 
> On 2/16/15 12:37 PM, Hal Finkel wrote:
> > ----- Original Message -----
> >> From: "Haopeng Liu" <hyliuhp at gmail.com>
> >> To: "Hal Finkel" <hfinkel at anl.gov>
> >> Cc: llvmdev at cs.uiuc.edu
> >> Sent: Monday, February 16, 2015 12:37:06 PM
> >> Subject: Re: [LLVMdev] alias result
> >>
> >> t and t2 are two pointers defined in .c file.
> >>
> >> The definitions in .bc are:
> >> %thd = alloc i64, align 8
> >> %t = alloca i64*, align 8
> >> %t2 = alloca i64*, align 8
> >>
> >> .c file likes this:
> >> int thd;
> >> int *t = &thd;
> >> int *t2 = t;
> > Okay, those point to distinct local stack allocations. Why do you
> > expect them to alias?
> >
> >   -Hal
> >
> >>
> >> On 2/16/15 12:28 PM, Hal Finkel wrote:
> >>> ----- Original Message -----
> >>>> From: "Haopeng Liu" <hyliuhp at gmail.com>
> >>>> To: llvmdev at cs.uiuc.edu
> >>>> Sent: Monday, February 16, 2015 12:12:18 PM
> >>>> Subject: [LLVMdev] alias result
> >>>>
> >>>> Hi all,
> >>>>
> >>>> I am implementing a pass which needs aliasanalysis in llvm.
> >>>>
> >>>> My pass firstly records all store or load instructions as
> >>>> follows:
> >>>> loc[cnt++] = AA.getLocation(si/li);
> >>>>
> >>>> Then, get each pairwise alias result.
> >>>> AliasAnalysis::AliasResult ar = AA.alias(loc[i], loc[j]);
> >>>> switch(ar){ case 0,1,2,3;}
> >>>>
> >>>> And the command is: opt -load mypass.so -mypass -basicaa test.bc
> >>>>
> >>>> The store/load in test.bc:
> >>>>
> >>>> (1): store i64* %thd, i64** %t, align 8    //int64 *t = &thd;
> >>>> (2): %1 = load i64** %t, align 8             //load t
> >>>> (3): store i64* %1, i64** %t2, align 8     //int64 *t2 = t;
> >>>> (4): %2 = load i64** %t, align 8             //load t
> >>>> (5): %3 = load i64** %t2, align 8           //load t2
> >>>>
> >>>> It seems that all these 5 instructions should be aliased to each
> >>>> other.
> >>>>
> >>>> But the result should that only (1,2) (1,4) (2,4) (3,5) are must
> >>>> alias.
> >>>> Others are no alias.
> >>> Where do %t and %t2 come from?
> >>>
> >>>    -Hal
> >>>
> >>>> Who can explain these results? Any hits would be appreciated.
> >>>> Thank
> >>>> you.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> LLVM Developers mailing list
> >>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >>>>
> >>
> 
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list