]> granicus.if.org Git - llvm/commit
Fix the merging of the constantness of declarations.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 30 Oct 2014 20:50:23 +0000 (20:50 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 30 Oct 2014 20:50:23 +0000 (20:50 +0000)
commit3d41cbb3f4bfd0482689a84c07e3fd8e24f5d9b5
treeac877fe0a438475986b63b6102aa7b9d1fe301ff
parentd33e67757ed6cdfd9429f42a1ea9db405d7be529
Fix the merging of the constantness of declarations.

The langref says:

LLVM explicitly allows declarations of global variables to be marked
constant, even if the final definition of the global is not. This
capability can be used to enable slightly better optimization of the
program, but requires the language definition to guarantee that
optimizations based on the ‘constantness’ are valid for the
translation units that do not include the definition.

Given that definition, when merging two declarations, we have to drop
constantness if of of them is not marked contant, since the Module
without the constant marker might not have the necessary guarantees.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220927 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Linker/LinkModules.cpp
test/Linker/ConstantGlobals3.ll