[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi closed https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: Well, since I'm not going to have time to work on this in the near future, and it will be quite a while before I can roll out an experimental toolchain to partners, I'm going to close this for now. Its easy enough to re-open when we have better feeling for its value, but I do still think its good to have a way to opt into a transform irrespective of the optlevel. https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
nikic wrote: > As for experimenting, I was hoping that you could just experiment locally > with local changes to LLVM. Is it much easier to experiment with a flag in > LLVM release? If so then this is fine. Agree that experimentation should be done with local changes to LLVM. Options like these tend to get added and never removed, even if they have outlived their usefulness. I could kind of see the rationale for adding it to LoopRotate (which is well-known to be problematic in this regard, and it's plausible to assume that more than one organization would have interest in testing the option), but I wouldn't want to encourage this as a general pattern for exploration of minsize optimization changes. https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
aeubanks wrote: > I don't think its a good idea to try and guess what the threshold should be. > Likely, that is something specific targets would need to tune on their own > via -dfa-cost-threshold=. The inliner has a target-independent threshold and it's much more important than this pass, so I don't see why this pass can't do the same thing. As for experimenting, I was hoping that you could just experiment locally with local changes to LLVM. Is it much easier to experiment with a flag in LLVM release? If so then this is fine. This pass is already experimental (given it's not enabled by default) so I'm not too worried about regressing it in terms of binary size. https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: So, if DFAJumpThreading is ever on by default, then I think its pretty simple to repurpose `-enable-dfa-jump-thread` to enable the behavior in the pass, and we can drop `-enable-dfa-jump-optsize` @aeubanks, does that sound like a better plan? https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
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 Date: Mon, 26 Feb 2024 21:42:24 + Subject: [PATCH 1/3] 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +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 cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt 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 ) { 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 Date: Mon, 26 Feb 2024 21:55:44 + Subject: [PATCH 2/3] 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +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()); >From 72ecbcc68501c976b3277b28edc6aeafff9f4dad Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Wed, 28 Feb 2024 00:22:40 + Subject: [PATCH 3/3] Fix missing match in test, due to a deleted line Created using spr 1.3.4 --- llvm/test/Transforms/DFAJumpThreading/negative.ll | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/test/Transforms/DFAJumpThreading/negative.ll b/llvm/test/Transforms/DFAJumpThreading/negative.ll index cce6cc887ff206..c822b6613f7334 100644 --- a/llvm/test/Transforms/DFAJumpThreading/negative.ll +++ b/llvm/test/Transforms/DFAJumpThreading/negative.ll @@ -188,6 +188,7 @@ define i32 @negative5(i32 %num) minsize { ; CHECK-NEXT:ret i32 0 ; ; IGNORESIZE-LABEL: define i32 @negative5( +; IGNORESIZE-SAME: i32 [[NUM:%.*]]) #[[ATTR0:[0-9]+]] { ; IGNORESIZE-NEXT: entry: ; IGNORESIZE-NEXT:br label [[FOR_BODY:%.*]] ; IGNORESIZE: for.body: ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
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 Date: Mon, 26 Feb 2024 21:42:24 + Subject: [PATCH 1/3] 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +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 cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt 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 ) { 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 Date: Mon, 26 Feb 2024 21:55:44 + Subject: [PATCH 2/3] 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +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()); >From 72ecbcc68501c976b3277b28edc6aeafff9f4dad Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Wed, 28 Feb 2024 00:22:40 + Subject: [PATCH 3/3] Fix missing match in test, due to a deleted line Created using spr 1.3.4 --- llvm/test/Transforms/DFAJumpThreading/negative.ll | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/test/Transforms/DFAJumpThreading/negative.ll b/llvm/test/Transforms/DFAJumpThreading/negative.ll index cce6cc887ff206..c822b6613f7334 100644 --- a/llvm/test/Transforms/DFAJumpThreading/negative.ll +++ b/llvm/test/Transforms/DFAJumpThreading/negative.ll @@ -188,6 +188,7 @@ define i32 @negative5(i32 %num) minsize { ; CHECK-NEXT:ret i32 0 ; ; IGNORESIZE-LABEL: define i32 @negative5( +; IGNORESIZE-SAME: i32 [[NUM:%.*]]) #[[ATTR0:[0-9]+]] { ; IGNORESIZE-NEXT: entry: ; IGNORESIZE-NEXT:br label [[FOR_BODY:%.*]] ; IGNORESIZE: for.body: ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi edited https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: > Can we have a more principled approach to determine when to allow this pass > to run than a `cl::opt`? For example, change the `CostThreshold` in the pass > depending on whether or not the function has `optsize`. So, I've experimented with this, and I'm not sure this is the right approach to take right away. I think its premature to suppose that at `-Oz` we would ever want this pass on by default. I don't think its a good idea to try and guess what the threshold should be. Likely, that is something specific targets would need to tune on their own via `-dfa-cost-threshold=`. I don't see a better way to allow us to experiment with this, than adding this flag, which is simple(allow the pass w/ optsize), and we can still use `-dfa-cost-threshold=` to determine what we should choose. I'd like to avoid running afoul of this pass being on by default in the future for size optimized targets when we're still in the experimental stage of evaluating this passes usefulness when combined with size optimizations. I agree that if we believe this is a good default in the future, we should adjust the logic to modify the threshold for optsize, but right now I don't have confidence that is the correct way forward. I'm looking to see if there is a way to use -enable-dfa-jump-threading to control this behavior, instead of introducing a new cl::opt. https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
llvmbot wrote: @llvm/pr-subscribers-llvm-transforms Author: Paul Kirth (ilovepi) Changes Though DFAJumpThreadingPass typically introduces size increases, targets optimizing for size may want to enable the pass for certain TUs and workloads. This change adds options to override the default behavior, and enable the DFAJumpThreadingPass to run, even when compiling for size. --- Full diff: https://github.com/llvm/llvm-project/pull/83049.diff 3 Files Affected: - (modified) llvm/lib/Passes/PassBuilderPipelines.cpp (+5) - (modified) llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp (+6-1) - (modified) llvm/test/Transforms/DFAJumpThreading/negative.ll (+49) ``diff diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index cbbbec0ccc8c4d..3b2d4523ef7e8e 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -222,6 +222,11 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); +static cl::opt +DFAJumpThreadingOptSize("dfa-jump-thread-optsize", + cl::desc("Enable DFA jump threading when optimizing for size"), + cl::init(false), cl::Hidden); + // TODO: turn on and remove flag static cl::opt EnablePGOForceFunctionAttrs( diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp index 85d4065286e41f..ce5e823e531e0f 100644 --- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp @@ -110,6 +110,11 @@ static cl::opt cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); +static cl::opt DFAJumpThreadIgnoreOptSize( +"dfa-jump-ignore-optsize", +cl::desc("Enable dfa jump threading, even when optimizing for size"), +cl::Hidden, cl::init(false)); + namespace { class SelectInstToUnfold { @@ -1244,7 +1249,7 @@ struct TransformDFA { bool DFAJumpThreading::run(Function ) { LLVM_DEBUG(dbgs() << "\nDFA Jump threading: " << F.getName() << "\n"); - if (F.hasOptSize()) { + if (!DFAJumpThreadIgnoreOptSize && F.hasOptSize()) { LLVM_DEBUG(dbgs() << "Skipping due to the 'minsize' attribute\n"); return false; } diff --git a/llvm/test/Transforms/DFAJumpThreading/negative.ll b/llvm/test/Transforms/DFAJumpThreading/negative.ll index a9642814276992..c822b6613f7334 100644 --- a/llvm/test/Transforms/DFAJumpThreading/negative.ll +++ b/llvm/test/Transforms/DFAJumpThreading/negative.ll @@ -1,6 +1,7 @@ ; RUN: opt -passes=dfa-jump-threading -dfa-cost-threshold=25 -pass-remarks-missed='dfa-jump-threading' -pass-remarks-output=%t -disable-output %s ; RUN: FileCheck --input-file %t --check-prefix=REMARK %s ; RUN: opt -S -passes=dfa-jump-threading %s | FileCheck %s +; RUN: opt -S -passes=dfa-jump-threading -dfa-jump-ignore-optsize %s | FileCheck %s --check-prefix=IGNORESIZE ; This negative test case checks that the optimization doesn't trigger ; when the code size cost is too high. @@ -186,6 +187,54 @@ define i32 @negative5(i32 %num) minsize { ; CHECK: for.end: ; CHECK-NEXT:ret i32 0 ; +; IGNORESIZE-LABEL: define i32 @negative5( +; IGNORESIZE-SAME: i32 [[NUM:%.*]]) #[[ATTR0:[0-9]+]] { +; IGNORESIZE-NEXT: entry: +; IGNORESIZE-NEXT:br label [[FOR_BODY:%.*]] +; IGNORESIZE: for.body: +; IGNORESIZE-NEXT:[[COUNT:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ] +; IGNORESIZE-NEXT:[[STATE:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ poison, [[FOR_INC]] ] +; IGNORESIZE-NEXT:switch i32 [[STATE]], label [[FOR_INC_JT1:%.*]] [ +; IGNORESIZE-NEXT:i32 1, label [[CASE1:%.*]] +; IGNORESIZE-NEXT:i32 2, label [[CASE2:%.*]] +; IGNORESIZE-NEXT:] +; IGNORESIZE: for.body.jt2: +; IGNORESIZE-NEXT:[[COUNT_JT2:%.*]] = phi i32 [ [[INC_JT2:%.*]], [[FOR_INC_JT2:%.*]] ] +; IGNORESIZE-NEXT:[[STATE_JT2:%.*]] = phi i32 [ [[STATE_NEXT_JT2:%.*]], [[FOR_INC_JT2]] ] +; IGNORESIZE-NEXT:br label [[CASE2]] +; IGNORESIZE: for.body.jt1: +; IGNORESIZE-NEXT:[[COUNT_JT1:%.*]] = phi i32 [ [[INC_JT1:%.*]], [[FOR_INC_JT1]] ] +; IGNORESIZE-NEXT:[[STATE_JT1:%.*]] = phi i32 [ [[STATE_NEXT_JT1:%.*]], [[FOR_INC_JT1]] ] +; IGNORESIZE-NEXT:br label [[CASE1]] +; IGNORESIZE: case1: +; IGNORESIZE-NEXT:[[COUNT2:%.*]] = phi i32 [ [[COUNT_JT1]], [[FOR_BODY_JT1:%.*]] ], [ [[COUNT]], [[FOR_BODY]] ] +; IGNORESIZE-NEXT:br label [[FOR_INC_JT2]] +; IGNORESIZE: case2: +; IGNORESIZE-NEXT:[[COUNT1:%.*]] = phi i32 [ [[COUNT_JT2]], [[FOR_BODY_JT2:%.*]] ], [ [[COUNT]], [[FOR_BODY]] ] +; IGNORESIZE-NEXT:[[CMP:%.*]] = icmp eq i32 [[COUNT1]], 50 +; IGNORESIZE-NEXT:br i1 [[CMP]], label [[FOR_INC_JT1]], label [[SI_UNFOLD_FALSE:%.*]] +; IGNORESIZE:
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi ready_for_review https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
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 Date: Mon, 26 Feb 2024 21:42:24 + Subject: [PATCH 1/3] 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +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 cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt 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 ) { 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 Date: Mon, 26 Feb 2024 21:55:44 + Subject: [PATCH 2/3] 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +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()); >From 72ecbcc68501c976b3277b28edc6aeafff9f4dad Mon Sep 17 00:00:00 2001 From: Paul Kirth Date: Wed, 28 Feb 2024 00:22:40 + Subject: [PATCH 3/3] Fix missing match in test, due to a deleted line Created using spr 1.3.4 --- llvm/test/Transforms/DFAJumpThreading/negative.ll | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/test/Transforms/DFAJumpThreading/negative.ll b/llvm/test/Transforms/DFAJumpThreading/negative.ll index cce6cc887ff206..c822b6613f7334 100644 --- a/llvm/test/Transforms/DFAJumpThreading/negative.ll +++ b/llvm/test/Transforms/DFAJumpThreading/negative.ll @@ -188,6 +188,7 @@ define i32 @negative5(i32 %num) minsize { ; CHECK-NEXT:ret i32 0 ; ; IGNORESIZE-LABEL: define i32 @negative5( +; IGNORESIZE-SAME: i32 [[NUM:%.*]]) #[[ATTR0:[0-9]+]] { ; IGNORESIZE-NEXT: entry: ; IGNORESIZE-NEXT:br label [[FOR_BODY:%.*]] ; IGNORESIZE: for.body: ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: > also, we should remove pipeline checks for "optsize" and move those checks > into the passes themselves done in https://github.com/llvm/llvm-project/pull/83188 https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
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 Date: Mon, 26 Feb 2024 21:42:24 + 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +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 cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt 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 ) { 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 Date: Mon, 26 Feb 2024 21:55:44 + 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +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()); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
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 Date: Mon, 26 Feb 2024 21:42:24 + 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +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 cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt 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 ) { 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 Date: Mon, 26 Feb 2024 21:55:44 + 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +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()); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
aeubanks wrote: also, we should remove pipeline checks for "optsize" and move those checks into the passes themselves https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: > This pass is not part of the default pipeline -- do you enable this pass > downstream, or do you want to add options for _all_ uses of minsize, even if > there is no evidence of usefulness? We’d like to see if this can be useful to some of our size constrained users in the embedded space. Particularly because it has been proposed to turn this on in the default pipeline. https://discourse.llvm.org/t/rfc-enable-dfa-jumpthreading-pass-by-default/77231. Currently we don’t have evidence that this is beneficial, but for these targets we also don’t have a way to vet that with the current implementation. So to be concrete, I’d like the ability to enable this pass somehow even if compiling for size. If we can control this behavior with a threshold, then mechanically I don’t see much difference between that an the flags I’ve added in this pass. But right now we don’t have a way to evaluate if this may be useful at any threshold, and I think it’s useful if we can turn this knob in some way without changing the default behavior. https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
nikic wrote: This pass is not part of the default pipeline -- do you enable this pass downstream, or do you want to add options for *all* uses of minsize, even if there is no evidence of usefulness? https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: > Can we have a more principled approach to determine when to allow this pass > to run than a `cl::opt`? For example, change the `CostThreshold` in the pass > depending on whether or not the function has `optsize`. Sure. I can take a look at doing it that way instead. it will probably be much cleaner. https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
aeubanks wrote: Can we have a more principled approach to determine when to allow this pass to run than a `cl::opt`? For example, change the `CostThreshold` in the pass depending on whether or not the function has `optsize`. https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
ilovepi wrote: cc: @petrhosek @PiJoules since I think they're interested. https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
@@ -222,6 +222,11 @@ static cl::opt EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); +static cl::opt +DFAJumpThreadingOptSize("dfa-jump-thread-optsize", + cl::desc("Enable DFA jump threading when optimizing for size"), + cl::init(false), cl::Hidden); + ilovepi wrote: Its rather unfortunate that we need 2 flags to enable a single behavior ... Is there a common place we can put this flag and use it here and in `DFAJumpThreading.cpp`? https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
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 Date: Mon, 26 Feb 2024 21:42:24 + 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +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 cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt 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 ) { 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 Date: Mon, 26 Feb 2024 21:55:44 + 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -extern cl::opt -OptSizeDFAJumpThreading("dfa-jump-thread-optsize", +static cl::opt +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()); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
https://github.com/ilovepi edited https://github.com/llvm/llvm-project/pull/83049 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [llvm][dfa-jump-threading] Allow DFAJumpThreading with optsize (PR #83049)
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 Date: Mon, 26 Feb 2024 21:42:24 + 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 EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(false), cl::Hidden); -static cl::opt -OptSizeDFAJumpThreading("optsize-dfa-jump-thread", +extern cl::opt +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 cl::desc("Maximum cost accepted for the transformation"), cl::Hidden, cl::init(50)); -static cl::opt -IgnoreOptSize("dfa-jump-ignore-optsize", -cl::desc("Enable dfa jump threading, even when optimizing for size"), -cl::Hidden, cl::init(false)); - +static cl::opt 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 ) { 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; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits