diff --git a/include/llvm/Transforms/IPO/Attributor.h b/include/llvm/Transforms/IPO/Attributor.h index 54a980523d2..2fd5f59efa6 100644 --- a/include/llvm/Transforms/IPO/Attributor.h +++ b/include/llvm/Transforms/IPO/Attributor.h @@ -775,6 +775,12 @@ struct Attributor { /// Return the internal information cache. InformationCache &getInfoCache() { return InfoCache; } + /// Return true if this is a module pass, false otherwise. + bool isModulePass() const { + return !Functions.empty() && + Functions.size() == Functions.front()->getParent()->size(); + } + /// Determine opportunities to derive 'default' attributes in \p F and create /// abstract attribute objects for them. /// diff --git a/lib/Transforms/IPO/Attributor.cpp b/lib/Transforms/IPO/Attributor.cpp index f089ba7ce93..7d6ea0fa2db 100644 --- a/lib/Transforms/IPO/Attributor.cpp +++ b/lib/Transforms/IPO/Attributor.cpp @@ -4577,6 +4577,17 @@ struct AAValueSimplifyArgument final : AAValueSimplifyImpl { if (hasAttr({Attribute::InAlloca, Attribute::StructRet, Attribute::Nest}, /* IgnoreSubsumingPositions */ true)) indicatePessimisticFixpoint(); + + // FIXME: This is a hack to prevent us from propagating function poiner in + // the new pass manager CGSCC pass as it creates call edges the + // CallGraphUpdater cannot handle yet. + Value &V = getAssociatedValue(); + if (V.getType()->isPointerTy() && + V.getType()->getPointerElementType()->isFunctionTy() && + !A.isModulePass() && + A.getInfoCache().getAnalysisResultForFunction( + *getAnchorScope())) + indicatePessimisticFixpoint(); } /// See AbstractAttribute::updateImpl(...). @@ -4700,6 +4711,7 @@ struct AAValueSimplifyFloating : AAValueSimplifyImpl { /// See AbstractAttribute::initialize(...). void initialize(Attributor &A) override { + AAValueSimplifyImpl::initialize(A); Value &V = getAnchorValue(); // TODO: add other stuffs