Mikael Holmén via llvm-dev
2016-Apr-19 05:55 UTC
[llvm-dev] Different index types in GEPs -> non-aliasing?
Hi, On 04/18/2016 05:28 PM, Vedant Kumar wrote:> This sounds like a bug to me. > > >> // If the last (struct) indices are constants and are equal, the other indices >> // might be also be dynamically equal, so the GEPs can alias. >> if (C1 && C2 && C1 == C2) >> return MayAlias; > > Does changing this condition fix the issue? E.g > > if (C1 && C2 && C1->getSExtValue() == C2->getSExtValue()) { ... }Yes it does. Then it realize the two GEPs alias and I get the expected result. But since there is also a Value pointer comparison in bool BasicAAResult::isValueEqualInPotentialCycles(const Value *V, const Value *V2) { if (V != V2) return false; and probably in several other places too I wasn't comfortable just changing it... Right now I made my front-end always use i64 for GEP array indices instead. Should I file a bugzilla report on this? Regards, Mikael> > > best > vedant >
Vedant Kumar via llvm-dev
2016-Apr-19 05:59 UTC
[llvm-dev] Different index types in GEPs -> non-aliasing?
> On Apr 18, 2016, at 10:55 PM, Mikael Holmén <mikael.holmen at ericsson.com> wrote: > > Hi, > > On 04/18/2016 05:28 PM, Vedant Kumar wrote: >> This sounds like a bug to me. >> >> >>> // If the last (struct) indices are constants and are equal, the other indices >>> // might be also be dynamically equal, so the GEPs can alias. >>> if (C1 && C2 && C1 == C2) >>> return MayAlias; >> >> Does changing this condition fix the issue? E.g >> >> if (C1 && C2 && C1->getSExtValue() == C2->getSExtValue()) { ... } > > Yes it does. Then it realize the two GEPs alias and I get the expected result. > > But since there is also a Value pointer comparison in > > bool BasicAAResult::isValueEqualInPotentialCycles(const Value *V, > const Value *V2) { > if (V != V2) > return false; > > and probably in several other places too I wasn't comfortable just changing it... Right now I made my front-end always use i64 for GEP array indices instead.Yes, I think it'd be best to open up a bug for this. thanks vedant> Should I file a bugzilla report on this? > > Regards, > Mikael > >> >> >> best >> vedant >>
Mikael Holmén via llvm-dev
2016-Apr-19 06:10 UTC
[llvm-dev] Different index types in GEPs -> non-aliasing?
Hi, On 04/19/2016 07:59 AM, Vedant Kumar wrote:> > [...] > > Yes, I think it'd be best to open up a bug for this. > > thanks > vedantAlright, here it is https://llvm.org/bugs/show_bug.cgi?id=27418 Regards, Mikael