[llvm] Passes: Consolidate EnableKnowledgeRetention declarations into a header file (PR #71695)

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 07:51:06 PST 2023


https://github.com/tstellar created https://github.com/llvm/llvm-project/pull/71695

None

>From 53c52bbdb9da5bb97dd3df28412fac86cc1895b4 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 5 Aug 2023 05:14:04 +0000
Subject: [PATCH] Passes: Consolidate EnableKnowledgeRetention declarations
 into a header file

---
 llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h | 3 +++
 llvm/lib/Passes/PassBuilderPipelines.cpp                 | 1 -
 llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp     | 6 ------
 llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp      | 1 -
 4 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h b/llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h
index 7c3c8eb8d6a44e9..85c49d39098bc1d 100644
--- a/llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h
+++ b/llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h
@@ -18,6 +18,7 @@
 
 #include "llvm/Analysis/AssumeBundleQueries.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/CommandLine.h"
 
 namespace llvm {
 class AssumeInst;
@@ -26,6 +27,8 @@ class Instruction;
 class AssumptionCache;
 class DominatorTree;
 
+extern cl::opt<bool> EnableKnowledgeRetention;
+
 /// Build a call to llvm.assume to preserve informations that can be derived
 /// from the given instruction.
 /// If no information derived from \p I, this call returns null.
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index f4a4802bcb649f3..f3d280316e04077 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -302,7 +302,6 @@ PipelineTuningOptions::PipelineTuningOptions() {
 
 namespace llvm {
 extern cl::opt<unsigned> MaxDevirtIterations;
-extern cl::opt<bool> EnableKnowledgeRetention;
 } // namespace llvm
 
 void PassBuilder::invokePeepholeEPCallbacks(FunctionPassManager &FPM,
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index b0d31a92464e375..64cbfebf0102876 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -89,12 +89,6 @@ static cl::opt<unsigned> GuardWideningWindow(
     cl::desc("How wide an instruction window to bypass looking for "
              "another guard"));
 
-namespace llvm {
-/// enable preservation of attributes in assume like:
-/// call void @llvm.assume(i1 true) [ "nonnull"(i32* %PTR) ]
-extern cl::opt<bool> EnableKnowledgeRetention;
-} // namespace llvm
-
 /// Return the specified type promoted as it would be to pass though a va_arg
 /// area.
 static Type *getPromotedType(Type *Ty) {
diff --git a/llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp b/llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp
index a8a05e0caeee5d1..7a86e28ed59e6ad 100644
--- a/llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp
+++ b/llvm/unittests/Analysis/AssumeBundleQueriesTest.cpp
@@ -22,7 +22,6 @@ using namespace llvm;
 
 namespace llvm {
 extern cl::opt<bool> ShouldPreserveAllAttributes;
-extern cl::opt<bool> EnableKnowledgeRetention;
 } // namespace llvm
 
 static void RunTest(



More information about the llvm-commits mailing list