[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
Paul Kirth via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Feb 26 13:55:57 PST 2024
https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/83049
>From fc2e672d474442ef83e90c7a41265d6433651b63 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 26 Feb 2024 21:42:24 +0000
Subject: [PATCH 1/2] Refactor option names, and update test
Created using spr 1.3.4
---
llvm/lib/Passes/PassBuilderPipelines.cpp | 4 ++--
llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp | 11 +++++------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index e48a31f79cc0c5..9f81ff1899ac5f 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -222,8 +222,8 @@ static cl::opt<bool>
EnableDFAJumpThreading("enable-dfa-jump-thread",
cl::desc("Enable DFA jump threading"),
cl::init(false), cl::Hidden);
-static cl::opt<bool>
- OptSizeDFAJumpThreading("optsize-dfa-jump-thread",
+extern cl::opt<bool>
+ OptSizeDFAJumpThreading("dfa-jump-thread-optsize",
cl::desc("Enable DFA jump threading when optimizing for size"),
cl::init(false), cl::Hidden);
diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
index 9156d756310d14..ce5e823e531e0f 100644
--- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
@@ -110,11 +110,10 @@ static cl::opt<unsigned>
cl::desc("Maximum cost accepted for the transformation"),
cl::Hidden, cl::init(50));
-static cl::opt<bool>
- IgnoreOptSize("dfa-jump-ignore-optsize",
- cl::desc("Enable dfa jump threading, even when optimizing for size"),
- cl::Hidden, cl::init(false));
-
+static cl::opt<bool> DFAJumpThreadIgnoreOptSize(
+ "dfa-jump-ignore-optsize",
+ cl::desc("Enable dfa jump threading, even when optimizing for size"),
+ cl::Hidden, cl::init(false));
namespace {
@@ -1250,7 +1249,7 @@ struct TransformDFA {
bool DFAJumpThreading::run(Function &F) {
LLVM_DEBUG(dbgs() << "\nDFA Jump threading: " << F.getName() << "\n");
- if (!IgnoreOptSize && F.hasOptSize()) {
+ if (!DFAJumpThreadIgnoreOptSize && F.hasOptSize()) {
LLVM_DEBUG(dbgs() << "Skipping due to the 'minsize' attribute\n");
return false;
}
>From ffaa39b064da4d99e1834102ddbb38f0780e4ae7 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 26 Feb 2024 21:55:44 +0000
Subject: [PATCH 2/2] Make variable static + rename
Created using spr 1.3.4
---
llvm/lib/Passes/PassBuilderPipelines.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 9f81ff1899ac5f..a4db4614c6f830 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -222,8 +222,8 @@ static cl::opt<bool>
EnableDFAJumpThreading("enable-dfa-jump-thread",
cl::desc("Enable DFA jump threading"),
cl::init(false), cl::Hidden);
-extern cl::opt<bool>
- OptSizeDFAJumpThreading("dfa-jump-thread-optsize",
+static cl::opt<bool>
+ DFAJumpThreadingOptSize("dfa-jump-thread-optsize",
cl::desc("Enable DFA jump threading when optimizing for size"),
cl::init(false), cl::Hidden);
@@ -723,7 +723,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
// Re-consider control flow based optimizations after redundancy elimination,
// redo DCE, etc.
if (EnableDFAJumpThreading &&
- ((Level.getSizeLevel() == 0) || OptSizeDFAJumpThreading))
+ ((Level.getSizeLevel() == 0) || DFAJumpThreadingOptSize))
FPM.addPass(DFAJumpThreadingPass());
FPM.addPass(JumpThreadingPass());
More information about the llvm-branch-commits
mailing list