]> granicus.if.org Git - llvm/commit
SROA: Allow eliminating addrspacecasted allocas
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 14 Jun 2019 21:38:31 +0000 (21:38 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 14 Jun 2019 21:38:31 +0000 (21:38 +0000)
commitfe203355451c6cea3dafb68233c89607a2dd100c
tree857d644eee03986d7b14f8caf98cc4f60fdaba17
parent0ecb3ce855c397d237b0ea3bf43d97ed806c2b26
SROA: Allow eliminating addrspacecasted allocas

There is a circular dependency between SROA and InferAddressSpaces
today that requires running both multiple times in order to be able to
eliminate all simple allocas and addrspacecasts. InferAddressSpaces
can't remove addrspacecasts when written to memory, and SROA helps
move pointers out of memory.

This should avoid inserting new commuting addrspacecasts with GEPs,
since there are unresolved questions about pointer wrapping between
different address spaces.

For now, don't replace volatile operations that don't match the alloca
addrspace, as it would change the address space of the access. It may
be still OK to insert an addrspacecast from the new alloca, but be
more conservative for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363462 91177308-0d34-0410-b5e6-96231b3b80d8
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