[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:42:36 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] 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;
   }



More information about the llvm-branch-commits mailing list