[Attributor][FIX] Do not create new calls edge we cannot handle
If we propagate function pointers across function boundaries we can
create new call edges. These need to be represented in the CG if we run
as a CGSCC pass. In the new pass manager that is currently not handled
by the CallGraphUpdater so we need to prevent the situation for now.
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index f089ba7..7d6ea0f 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -4577,6 +4577,17 @@
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<LoopAnalysis>(
+ *getAnchorScope()))
+ indicatePessimisticFixpoint();
}
/// See AbstractAttribute::updateImpl(...).
@@ -4700,6 +4711,7 @@
/// See AbstractAttribute::initialize(...).
void initialize(Attributor &A) override {
+ AAValueSimplifyImpl::initialize(A);
Value &V = getAnchorValue();
// TODO: add other stuffs