From 7a41fbe432bc68edd8763a747e31cb9a75b791b2 Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Mon, 7 Oct 2019 23:21:52 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373986 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Transforms/IPO/Attributor.h | 4 ++-- lib/Transforms/IPO/Attributor.cpp | 8 ++++---- test/Transforms/FunctionAttrs/internal-noalias.ll | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/llvm/Transforms/IPO/Attributor.h b/include/llvm/Transforms/IPO/Attributor.h index 1811c233ebd..be41f82d7d0 100644 --- a/include/llvm/Transforms/IPO/Attributor.h +++ b/include/llvm/Transforms/IPO/Attributor.h @@ -810,8 +810,8 @@ struct Attributor { /// This will trigger the identification and initialization of attributes for /// \p F. void markLiveInternalFunction(const Function &F) { - assert(F.hasInternalLinkage() && - "Only internal linkage is assumed dead initially."); + assert(F.hasLocalLinkage() && + "Only local linkage is assumed dead initially."); identifyDefaultAbstractAttributes(const_cast(F)); } diff --git a/lib/Transforms/IPO/Attributor.cpp b/lib/Transforms/IPO/Attributor.cpp index 6c389f33f73..0bd454d8865 100644 --- a/lib/Transforms/IPO/Attributor.cpp +++ b/lib/Transforms/IPO/Attributor.cpp @@ -2081,7 +2081,7 @@ struct AAIsDeadImpl : public AAIsDead { for (const Instruction &I : BB) if (ImmutableCallSite ICS = ImmutableCallSite(&I)) if (const Function *F = ICS.getCalledFunction()) - if (F->hasInternalLinkage()) + if (F->hasLocalLinkage()) A.markLiveInternalFunction(*F); } @@ -3933,7 +3933,7 @@ bool Attributor::checkForAllCallSites( if (!AssociatedFunction) return false; - if (RequireAllCallSites && !AssociatedFunction->hasInternalLinkage()) { + if (RequireAllCallSites && !AssociatedFunction->hasLocalLinkage()) { LLVM_DEBUG( dbgs() << "[Attributor] Function " << AssociatedFunction->getName() @@ -4319,7 +4319,7 @@ ChangeStatus Attributor::run(Module &M) { // below fixpoint loop will identify and eliminate them. SmallVector InternalFns; for (Function &F : M) - if (F.hasInternalLinkage()) + if (F.hasLocalLinkage()) InternalFns.push_back(&F); 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 // direct call, we have to do it eagerly. - if (F.hasInternalLinkage()) { + if (F.hasLocalLinkage()) { if (llvm::all_of(F.uses(), [](const Use &U) { return ImmutableCallSite(U.getUser()) && ImmutableCallSite(U.getUser()).isCallee(&U); diff --git a/test/Transforms/FunctionAttrs/internal-noalias.ll b/test/Transforms/FunctionAttrs/internal-noalias.ll index cc207031015..9eec60b5e1e 100644 --- a/test/Transforms/FunctionAttrs/internal-noalias.ll +++ b/test/Transforms/FunctionAttrs/internal-noalias.ll @@ -8,9 +8,9 @@ entry: 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: %0 = load i32, i32* %A, align 4 %1 = load i32, i32* %B, align 4 -- 2.40.0