[ConstantFold] Make areGlobalsPotentiallyEqual less aggressive.
authorEli Friedman <efriedma@quicinc.com>
Fri, 4 Sep 2020 03:58:56 +0000 (20:58 -0700)
committerEli Friedman <efriedma@quicinc.com>
Sat, 12 Sep 2020 00:23:08 +0000 (17:23 -0700)
commitd751f86189a7f7ef2a6fe06974a5da3349b02f20
treef6b437844ca359e62506de59dd4d63ced0d070d3
parentc931dc0bf596ed0a6c4531b0e1f05bd8bda566a6
[ConstantFold] Make areGlobalsPotentiallyEqual less aggressive.

In particular, we shouldn't make assumptions about globals which are
unnamed_addr: we can fold them together with other globals.

Also while I'm here, use isInterposable() instead of trying to
explicitly name all the different kinds of weak linkage.

Fixes https://bugs.llvm.org/show_bug.cgi?id=47090

Differential Revision: https://reviews.llvm.org/D87123
llvm/lib/IR/ConstantFold.cpp
llvm/test/Assembler/ConstantExprNoFold.ll
llvm/test/Transforms/InstCombine/2010-03-03-ExtElim.ll