]> granicus.if.org Git - llvm/commitdiff
[Attributor][NFC] Avoid unnecessary liveness queries
authorJohannes Doerfert <jdoerfert@anl.gov>
Wed, 7 Aug 2019 22:32:38 +0000 (22:32 +0000)
committerJohannes Doerfert <jdoerfert@anl.gov>
Wed, 7 Aug 2019 22:32:38 +0000 (22:32 +0000)
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

lib/Transforms/IPO/Attributor.cpp

index 46dd8b447ec0075d216e15023be63e9859030ab9..2cc140a099f43a2e0c44147bf2e31eec88947a7e 100644 (file)
@@ -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;
 }