[PATCH] D79314: PR45733 : global weak symbol are excluded from the optimization .
Umesh Kalappa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 5 05:20:57 PDT 2020
umesh.kalappa0 updated this revision to Diff 262068.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79314/new/
https://reviews.llvm.org/D79314
Files:
llvm/lib/Analysis/ConstantFolding.cpp
llvm/lib/Transforms/Scalar/SCCP.cpp
Index: llvm/lib/Transforms/Scalar/SCCP.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SCCP.cpp
+++ llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -201,7 +201,7 @@
/// performing Interprocedural SCCP.
void TrackValueOfGlobalVariable(GlobalVariable *GV) {
// We only track the contents of scalar globals.
- if (GV->getValueType()->isSingleValueType()) {
+ if (GV->getValueType()->isSingleValueType() && GV->hasUniqueInitializer()) {
ValueLatticeElement &IV = TrackedGlobals[GV];
if (!isa<UndefValue>(GV->getInitializer()))
IV.markConstant(GV->getInitializer());
Index: llvm/lib/Analysis/ConstantFolding.cpp
===================================================================
--- llvm/lib/Analysis/ConstantFolding.cpp
+++ llvm/lib/Analysis/ConstantFolding.cpp
@@ -636,7 +636,7 @@
const DataLayout &DL) {
// First, try the easy cases:
if (auto *GV = dyn_cast<GlobalVariable>(C))
- if (GV->isConstant() && GV->hasDefinitiveInitializer())
+ if (GV->isConstant() && GV->hasUniqueInitializer())
return GV->getInitializer();
if (auto *GA = dyn_cast<GlobalAlias>(C))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79314.262068.patch
Type: text/x-patch
Size: 1215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200505/cbbda2dd/attachment.bin>
More information about the llvm-commits
mailing list