a basic BasicAA question

Hi -

I'm working on writing some tests for some BasicAA cases and I noticed
something I can't explain. It's probably a detail I don't understand
but I thought I'd ask about it since it seems to me to be a really
simple case.

If I have

define void @test1(double* %P, i64 %i) {
  %sum = add nuw nsw i64 %i, 128
  %A = getelementptr double, double* %P, i64 %sum
  ret void

in a file, let's say, tiny.ll, and I run

opt-6.0 -basicaa -aa-eval -print-may-aliases -disable-output tiny.ll
(or just opt)

it prints out

Function: test1: 2 pointers, 0 call sites
  MayAlias: double* %A, double* %P

Here I am surprised that it isn't able to determine that %P and %A cannot alias.

Is this a case that BasicAA ignores (for one reason or another) or is
there a fundamental reason that these two may alias according to the
IR I've shown?



The relevant code in BasicAA (BasicAAResult::aliasGEP) doesn't handle nuw markings.