OSDN Git Service

Make sure that any new and optimized objects created during GlobalOPT copy all the...
authorSergei Larin <slarin@codeaurora.org>
Fri, 22 Jan 2016 21:18:20 +0000 (21:18 +0000)
committerSergei Larin <slarin@codeaurora.org>
Fri, 22 Jan 2016 21:18:20 +0000 (21:18 +0000)
commit84f76e4fbf11784c7a0c66e904b1d0a39933e7f3
tree8898b4f186118d9266142bc9ad4b4332d1be85e1
parent4f27c4d28fcfee354e57d7cf6a8cd5fecbbec405
Make sure that any new and optimized objects created during GlobalOPT copy all the attributes from the base object.

Summary:
Make sure that any new and optimized objects created during GlobalOPT copy all the attributes from the base object.

A good example of improper behavior in the current implementation is section information associated with the GlobalObject. If a section was set for it, and GlobalOpt is creating/modifying a new object based on this one (often copying the original name), without this change new object will be placed in a default section, resulting in inappropriate properties of the new variable.
The argument here is that if customer specified a section for a variable, any changes to it that compiler does should not cause it to change that section allocation.
Moreover, any other properties worth representation in copyAttributesFrom() should also be propagated.

Reviewers: jmolloy, joker-eph, joker.eph

Subscribers: slarin, joker.eph, rafael, tobiasvk, llvm-commits

Differential Revision: http://reviews.llvm.org/D16074

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