[llvm-dev] Different index types in GEPs -> non-aliasing?

Mikael Holmén via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 18 22:55:59 PDT 2016


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
>


More information about the llvm-dev mailing list