From: Johannes Doerfert Date: Wed, 7 Aug 2019 22:32:38 +0000 (+0000) Subject: [Attributor][NFC] Avoid unnecessary liveness queries X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e892d1f282c0f7458353c4b3e22b7e58e873e9f0;p=llvm [Attributor][NFC] Avoid unnecessary liveness queries If we know everything is live there is no need to query for liveness. Indicating a pessimistic fixpoint will cause the state to be "invalid" which will cause the Attributor to not return the AAIsDead on request, which will prevent us from querying isAssumedDead(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368223 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/IPO/Attributor.cpp b/lib/Transforms/IPO/Attributor.cpp index 46dd8b447ec..2cc140a099f 100644 --- a/lib/Transforms/IPO/Attributor.cpp +++ b/lib/Transforms/IPO/Attributor.cpp @@ -1617,6 +1617,16 @@ ChangeStatus AAIsDeadImpl::updateImpl(Attributor &A, dbgs() << "[AAIsDead] AssumedLiveBlocks: " << AssumedLiveBlocks.size() << " Total number of blocks: " << getAnchorScope().size() << "\n"); + // If we know everything is live there is no need to query for liveness. + if (NoReturnCalls.empty() && + getAnchorScope().size() == AssumedLiveBlocks.size()) { + // Indicating a pessimistic fixpoint will cause the state to be "invalid" + // which will cause the Attributor to not return the AAIsDead on request, + // which will prevent us from querying isAssumedDead(). + indicatePessimisticFixpoint(); + assert(!isValidState() && "Expected an invalid state!"); + } + return Status; }