[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
Wed Feb 28 13:36:44 PST 2024


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


More information about the llvm-branch-commits mailing list