-
-
Save nikic/101258f96b9973d63ab2fb92acbca028 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit fe01ab111b7d27b57fa9bed03ead0294cabba202 | |
Author: Nikita Popov <nikita.ppv@gmail.com> | |
Date: Sun Nov 8 15:47:19 2020 +0100 | |
Add batchaa stats | |
diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h | |
index 35ee7f4841e..41d4d8e6a42 100644 | |
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h | |
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h | |
@@ -41,6 +41,7 @@ | |
#include "llvm/ADT/None.h" | |
#include "llvm/ADT/Optional.h" | |
#include "llvm/ADT/SmallVector.h" | |
+#include "llvm/ADT/Statistic.h" | |
#include "llvm/Analysis/MemoryLocation.h" | |
#include "llvm/Analysis/TargetLibraryInfo.h" | |
#include "llvm/IR/Function.h" | |
@@ -61,6 +62,10 @@ class BasicBlock; | |
class DominatorTree; | |
class Value; | |
+extern Statistic AANumNoAlias; | |
+extern Statistic AANumMayAlias; | |
+extern Statistic AANumMustAlias; | |
+ | |
/// The possible results of an alias query. | |
/// | |
/// These results are always computed between two MemoryLocation objects as | |
@@ -829,7 +834,14 @@ class BatchAAResults { | |
public: | |
BatchAAResults(AAResults &AAR) : AA(AAR), AAQI() {} | |
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB) { | |
- return AA.alias(LocA, LocB, AAQI); | |
+ AliasResult Res = AA.alias(LocA, LocB, AAQI); | |
+ if (Res == NoAlias) | |
+ ++AANumNoAlias; | |
+ else if (Res == MustAlias) | |
+ ++AANumMustAlias; | |
+ else | |
+ ++AANumMayAlias; | |
+ return Res; | |
} | |
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal = false) { | |
return AA.pointsToConstantMemory(Loc, AAQI, OrLocal); | |
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
index 44f9142d3e1..ea61b1f277e 100644 | |
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
@@ -65,6 +65,10 @@ | |
using namespace llvm; | |
+Statistic llvm::AANumNoAlias = {DEBUG_TYPE, "AANumNoAlias", "BatchAA NoAlias results"}; | |
+Statistic llvm::AANumMayAlias = {DEBUG_TYPE, "AANumMayAlias", "BatchAA MayAlias results"}; | |
+Statistic llvm::AANumMustAlias = {DEBUG_TYPE, "AANumMustAlias", "BatchAA MustAlias results"}; | |
+ | |
/// Enable analysis of recursive PHI nodes. | |
static cl::opt<bool> EnableRecPhiAnalysis("basic-aa-recphi", cl::Hidden, | |
cl::init(true)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment