[PATCH] D31924: SROA: Allow eliminating addrspacecasted allocas

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 13:25:02 PDT 2017


arsenm added a comment.

In https://reviews.llvm.org/D31924#733213, @chandlerc wrote:

> Restricting addrspace cast in this way seems... really hard to get right. I still have the question Eli asked: what does this mean in the absence of inbounds? What if the address spaces have different wrapping behavior even though they have the same number of bits?
>
> Consider an address space where there are tag bits in the high bits and one where there aren't. These may appear to be the same type, but the GEP-ing rule you propose doesn't seem to generally hold.
>
> And that's just one example. I'm not sure even restricting this to inbounds will really fix the issue.
>
> What about approaching this more from the inference perspective? Could we embed the inference into the iteration of SROA without shifting the restrictions so much?


I'm not sure exactly what you mean by this. Do you mean somehow merging InferAddressSpaces and SROA?



================
Comment at: lib/Analysis/PtrUseVisitor.cpp:34
 
-  return GEPI.accumulateConstantOffset(DL, Offset);
+  APInt TmpOffset(DL.getPointerTypeSizeInBits(GEPI.getType()), 0);
+  if (GEPI.accumulateConstantOffset(DL, TmpOffset)) {
----------------
theraven wrote:
> No changes suggested here, but in our version we have queries on the data layout that differentiate between the type and the range of a pointer (ours are 128- or 256-bit sized, but with a 64-bit range).
We will probably need this at some point for using pointers for resource descriptors 


https://reviews.llvm.org/D31924





More information about the llvm-commits mailing list