[MemorySSA] Does the accessedBetween support scalable vector pointer?

hi,
Base on the test case llvm/test/Transforms/MemCpyOpt/vscale-memset.ll, we can known all of %tmp0, %tmp1, %tmp2, %tmp3, … should not be aliased each other, and I also use the interface isNoAlias to confirm this (it return false as expected).

While I try to use the interface accessedBetween, I find it return true, so does it mean that the address of instruction SI is accessed by the %tmp2 ? But apparently, their addresses are not aliased.
We can see interface accessedBetween here llvm-project/MemCpyOptimizer.cpp at main · llvm/llvm-project · GitHub.

BTW: writtenBetween(MSSA, MemoryLocation::get(SI),MSSA->getMemoryAccess(SI),MSSA->getMemoryAccess(NextStore)) also return true. llvm-project/MemCpyOptimizer.cpp at main · llvm/llvm-project · GitHub

I think you are misreading the result. isNoAlias() returns false, which means they do alias.

And indeed, scalable vector support in BasicAA is currently essentially limited to “don’t crash”, because they don’t support GEP decomposition. We could support your particular example relatively easily though, because the scalable index is zero, so this is effectively a constant offset GEP.

1 Like

Thanks @nikic very much for your guide.

Do you mean D110511 is the one which limited the scalable vector ?

If yes. In this case, can we relax the conditon if both the type of V2->getType() and GEP1->getType() are not a scalable vector ponter?

(gdb) p V2->dump()
  %tmp1 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 1
$35 = void
(gdb) p GEP1->dump()
  %tmp2 = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %a, i32 0, i32 2
(gdb) p V2->getType()->dump()
i8*

try to address the above improvement, ⚙ D133567 [AA] Improve the BasicAA analysis capability

I don’t sure this is the direction to improve the AA more, ⚙ D133844 [AA] Improve the BasicAA analysis capability base on GEP, so I’am much appreciated for guidance.