Skip to content

Commit

Permalink
[llvm] Restore the ppc64le support that we lost in llvm8.
Browse files Browse the repository at this point in the history
This patch is backported from https://reviews.llvm.org/D94183

For more discussion see numba/numba#4026

Fixes #8072 and #9297
  • Loading branch information
vgvassilev committed Dec 4, 2021
1 parent e266028 commit 55ae047
Showing 1 changed file with 9 additions and 8 deletions.
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

0 comments on commit 55ae047

Please sign in to comment.