[GlobalOpt] Localize some globals that have non-instruction users
authorJames Molloy <james.molloy@arm.com>
Thu, 19 Nov 2015 18:04:33 +0000 (18:04 +0000)
committerJames Molloy <james.molloy@arm.com>
Thu, 19 Nov 2015 18:04:33 +0000 (18:04 +0000)
commita6b4079da30ccade414444e89301021cb9485e47
tree3a8d3ecf1d0c95e6bc96e4609bcf10dea7f700d5
parent4105a7b5677d25851b26936bf15ca919d3d9eb7c
[GlobalOpt] Localize some globals that have non-instruction users

We currently bail out of global localization if the global has non-instruction users. However, often these can be simple bitcasts or constant-GEPs, which we can easily turn into instructions before localizing. Be a bit more aggressive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253584 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/GlobalOpt.cpp
test/Transforms/GlobalOpt/localize-constexpr.ll [new file with mode: 0644]