Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions interpreter/llvm/src/lib/Target/PowerPC/PPCISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4463,7 +4463,15 @@ callsShareTOCBase(const Function *Caller, SDValue Callee,
if (!G)
return false;

const GlobalValue *GV = G->getGlobal();
const GlobalValue *GV = G->getGlobal();

// If the GV is not a strong definition then we need to assume it can be
// replaced by another function at link time. The function that replaces
// it may not share the same TOC as the caller since the callee may be
// replaced by a PC Relative version of the same function.
if (!GV->isStrongDefinitionForLinker())
return false;

// The medium and large code models are expected to provide a sufficiently
// large TOC to provide all data addressing needs of a module with a
// single TOC. Since each module will be addressed with a single TOC then we
Expand All @@ -4472,13 +4480,6 @@ callsShareTOCBase(const Function *Caller, SDValue Callee,
CodeModel::Large == TM.getCodeModel())
return TM.shouldAssumeDSOLocal(*Caller->getParent(), GV);

// Otherwise we need to ensure callee and caller are in the same section,
// since the linker may allocate multiple TOCs, and we don't know which
// sections will belong to the same TOC base.

if (!GV->isStrongDefinitionForLinker())
return false;

// Any explicitly-specified sections and section prefixes must also match.
// Also, if we're using -ffunction-sections, then each function is always in
// a different section (the same is true for COMDAT functions).
Expand Down