File tree Expand file tree Collapse file tree 3 files changed +5
-40
lines changed Expand file tree Collapse file tree 3 files changed +5
-40
lines changed Original file line number Diff line number Diff line change @@ -239,17 +239,11 @@ void FunctionImportGlobalProcessing::processGlobalForThinLTO(GlobalValue &GV) {
239
239
// propagateConstants hasn't been run. We can't internalize GV
240
240
// in such case.
241
241
if (!GV.isDeclaration () && VI && ImportIndex.withGlobalValueDeadStripping ()) {
242
- if (GlobalVariable *V = dyn_cast<GlobalVariable>(&GV)) {
243
- // We can have more than one local with the same GUID, in the case of
244
- // same-named locals in different but same-named source files that were
245
- // compiled in their respective directories (so the source file name
246
- // and resulting GUID is the same). Find the one in this module.
247
- auto * GVS = dyn_cast<GlobalVarSummary>(
248
- ImportIndex.findSummaryInModule (VI, M.getModuleIdentifier ()));
249
- // At this stage "maybe" is "definitely"
250
- if (GVS && (GVS->maybeReadOnly () || GVS->maybeWriteOnly ()))
251
- V->addAttribute (" thinlto-internalize" );
252
- }
242
+ const auto &SL = VI.getSummaryList ();
243
+ auto *GVS = SL.empty () ? nullptr : dyn_cast<GlobalVarSummary>(SL[0 ].get ());
244
+ // At this stage "maybe" is "definitely"
245
+ if (GVS && (GVS->maybeReadOnly () || GVS->maybeWriteOnly ()))
246
+ cast<GlobalVariable>(&GV)->addAttribute (" thinlto-internalize" );
253
247
}
254
248
255
249
bool DoPromote = false ;
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments