1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[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.
This commit is contained in:
Johannes Doerfert 2020-02-16 23:04:25 -06:00
parent fb9c302f30
commit 2d32597cfc
2 changed files with 18 additions and 0 deletions

View File

@ -775,6 +775,12 @@ struct Attributor {
/// Return the internal information cache. /// Return the internal information cache.
InformationCache &getInfoCache() { return InfoCache; } 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 /// Determine opportunities to derive 'default' attributes in \p F and create
/// abstract attribute objects for them. /// abstract attribute objects for them.
/// ///

View File

@ -4577,6 +4577,17 @@ struct AAValueSimplifyArgument final : AAValueSimplifyImpl {
if (hasAttr({Attribute::InAlloca, Attribute::StructRet, Attribute::Nest}, if (hasAttr({Attribute::InAlloca, Attribute::StructRet, Attribute::Nest},
/* IgnoreSubsumingPositions */ true)) /* IgnoreSubsumingPositions */ true))
indicatePessimisticFixpoint(); 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(...). /// See AbstractAttribute::updateImpl(...).
@ -4700,6 +4711,7 @@ struct AAValueSimplifyFloating : AAValueSimplifyImpl {
/// See AbstractAttribute::initialize(...). /// See AbstractAttribute::initialize(...).
void initialize(Attributor &A) override { void initialize(Attributor &A) override {
AAValueSimplifyImpl::initialize(A);
Value &V = getAnchorValue(); Value &V = getAnchorValue();
// TODO: add other stuffs // TODO: add other stuffs