[PATCH] D46864: add 2 functions to the ALiasAnalysis interface (getAddressesDistance + ModRefSameBuffer)

Atheel Massalha via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 15 09:18:25 PDT 2018


atheel.ma added a comment.

Hi,
its very similar to the BasicAliasAnalysis aliasCheck() functions,
the declerations for the private function is:

BuffUseResult BasicAAResult::ModRefSameBufferCheck(

  const Value *V1, uint64_t V1Size, AAMDNodes V1AAInfo, int64_t ptr1Offset,

const Value *V2, uint64_t V2Size, AAMDNodes V2AAInfo, int64_t ptr2Offset,
	Optional<int64_t> &LocDistance, const Value *https://reviews.llvm.org/owners/package/1/, const Value *https://reviews.llvm.org/owners/package/2/) { ... }

were ptr1Offset is "MMOa->getPointerInfo().Offset"

inside I will try to get to the GEP of the 2 memory operands this will tell me if its the same buffer (memory block)
I may pass throw PHI and SELECT nodes like in aliasCheck(),
after i will have 2 GEP I will calculate the distance using:

int64_t GEP1BaseOffset =

      DecompGEP1.StructOffset + DecompGEP1.OtherOffset + ptr1Offset;
  int64_t GEP2BaseOffset =
      DecompGEP2.StructOffset + DecompGEP2.OtherOffset + ptr2Offset;
  LocDistance = GEP2BaseOffset - GEP1BaseOffset;

and I will save it inside a cache like aliasCache...

I have implemented it and test it on my Core and it works for most cases... 
it helps for detecting "Bank conflicts", when two memory instructions Mod/Ref from the same memory block, I can check if its also in the same bank if I have the distance between them and the size of each one of them...

the 2 functions I have added is generic and maybe other users will use it for something else...
If you also see how useful it is I will add a new patch with a first implementation (on BasicAliasAnalysis)


Repository:
  rL LLVM

https://reviews.llvm.org/D46864





More information about the llvm-commits mailing list