[Attributor] Use local linkage instead of internal

Local linkage is internal or private, and private is a specialization of
internal, so either is fine for all our "local linkage" queries.

llvm-svn: 373986
This commit is contained in:
Johannes Doerfert 2019-10-07 23:21:52 +00:00
parent 661db04b98
commit 766f2cc1a4
3 changed files with 8 additions and 8 deletions

View File

@ -810,8 +810,8 @@ struct Attributor {
/// This will trigger the identification and initialization of attributes for /// This will trigger the identification and initialization of attributes for
/// \p F. /// \p F.
void markLiveInternalFunction(const Function &F) { void markLiveInternalFunction(const Function &F) {
assert(F.hasInternalLinkage() && assert(F.hasLocalLinkage() &&
"Only internal linkage is assumed dead initially."); "Only local linkage is assumed dead initially.");
identifyDefaultAbstractAttributes(const_cast<Function &>(F)); identifyDefaultAbstractAttributes(const_cast<Function &>(F));
} }

View File

@ -2081,7 +2081,7 @@ struct AAIsDeadImpl : public AAIsDead {
for (const Instruction &I : BB) for (const Instruction &I : BB)
if (ImmutableCallSite ICS = ImmutableCallSite(&I)) if (ImmutableCallSite ICS = ImmutableCallSite(&I))
if (const Function *F = ICS.getCalledFunction()) if (const Function *F = ICS.getCalledFunction())
if (F->hasInternalLinkage()) if (F->hasLocalLinkage())
A.markLiveInternalFunction(*F); A.markLiveInternalFunction(*F);
} }
@ -3933,7 +3933,7 @@ bool Attributor::checkForAllCallSites(
if (!AssociatedFunction) if (!AssociatedFunction)
return false; return false;
if (RequireAllCallSites && !AssociatedFunction->hasInternalLinkage()) { if (RequireAllCallSites && !AssociatedFunction->hasLocalLinkage()) {
LLVM_DEBUG( LLVM_DEBUG(
dbgs() dbgs()
<< "[Attributor] Function " << AssociatedFunction->getName() << "[Attributor] Function " << AssociatedFunction->getName()
@ -4319,7 +4319,7 @@ ChangeStatus Attributor::run(Module &M) {
// below fixpoint loop will identify and eliminate them. // below fixpoint loop will identify and eliminate them.
SmallVector<Function *, 8> InternalFns; SmallVector<Function *, 8> InternalFns;
for (Function &F : M) for (Function &F : M)
if (F.hasInternalLinkage()) if (F.hasLocalLinkage())
InternalFns.push_back(&F); InternalFns.push_back(&F);
bool FoundDeadFn = true; bool FoundDeadFn = true;
@ -4634,7 +4634,7 @@ static bool runAttributorOnModule(Module &M, AnalysisGetter &AG) {
// We look at internal functions only on-demand but if any use is not a // We look at internal functions only on-demand but if any use is not a
// direct call, we have to do it eagerly. // direct call, we have to do it eagerly.
if (F.hasInternalLinkage()) { if (F.hasLocalLinkage()) {
if (llvm::all_of(F.uses(), [](const Use &U) { if (llvm::all_of(F.uses(), [](const Use &U) {
return ImmutableCallSite(U.getUser()) && return ImmutableCallSite(U.getUser()) &&
ImmutableCallSite(U.getUser()).isCallee(&U); ImmutableCallSite(U.getUser()).isCallee(&U);

View File

@ -8,9 +8,9 @@ entry:
ret i32 %add ret i32 %add
} }
; CHECK: define internal i32 @noalias_args(i32* nocapture readonly %A, i32* noalias nocapture readonly %B) ; CHECK: define private i32 @noalias_args(i32* nocapture readonly %A, i32* noalias nocapture readonly %B)
define internal i32 @noalias_args(i32* %A, i32* %B) #0 { define private i32 @noalias_args(i32* %A, i32* %B) #0 {
entry: entry:
%0 = load i32, i32* %A, align 4 %0 = load i32, i32* %A, align 4
%1 = load i32, i32* %B, align 4 %1 = load i32, i32* %B, align 4