[GlobalOpt] Allow constant globals to be SRA'd
authorJames Molloy <james.molloy@arm.com>
Mon, 25 Apr 2016 10:48:29 +0000 (10:48 +0000)
committerJames Molloy <james.molloy@arm.com>
Mon, 25 Apr 2016 10:48:29 +0000 (10:48 +0000)
commiteb040cc55f670fbb9087a5d5bf2bd1b3aa1dd403
tree33515323433f51772ccaaba0c11b75addfeb9f5c
parent3c924653c1e9cf0c6d86af11e4c88d3349da3936
[GlobalOpt] Allow constant globals to be SRA'd

The current logic assumes that any constant global will never be SRA'd. I presume this is because normally constant globals can be pushed into their uses and deleted. However, that sometimes can't happen (which is where you really want SRA, so the elements that can be eliminated, are!).

There seems to be no reason why we can't SRA constants too, so let's do it.

llvm-svn: 267393
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/test/Transforms/GlobalOpt/globalsra.ll