[PATCH] D31924: SROA: Allow eliminating addrspacecasted allocas

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 13:41:05 PDT 2019


arsenm updated this revision to Diff 203889.
arsenm edited the summary of this revision.
arsenm added a comment.

Re-apply change to insert a final addrspacecast in getAdjustedPtr, which is necessary in some cases.

Don't allow getAdjustedPtr to search through addrspacecast. This should prevent the questionable addrspacecast-GEP commuting behavior. The practical case that matters is an alloca immediately casted, and all addressing is done in the result address space, so getting the same GEP folds in all cases as a bitcast isn't critically important, though would be nice to have. Some new addrspacecasts may be introduced, but not followed by a GEP.

Fix changing the address space of volatile operations, although inserting a new addrspacecast should be OK in these cases. For now just leave these cases alone.

Also fix some missing test coverage.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D31924/new/

https://reviews.llvm.org/D31924

Files:
  include/llvm/Analysis/PtrUseVisitor.h
  lib/Analysis/PtrUseVisitor.cpp
  lib/Transforms/Scalar/SROA.cpp
  test/Transforms/SROA/addrspacecast.ll
  test/Transforms/SROA/basictest.ll
  test/Transforms/SROA/phi-and-select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31924.203889.patch
Type: text/x-patch
Size: 18684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190610/396e47c8/attachment.bin>


More information about the llvm-commits mailing list