Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 23857 - backend inliner takes too long on recursive function call #15437

Closed
wants to merge 1 commit into from

Conversation

dkorpel
Copy link
Contributor

@dkorpel dkorpel commented Jul 21, 2023

Blunt fix: disable backend inliner for now

@dkorpel dkorpel added the Backend glue code, optimizer, code generation label Jul 21, 2023
@dlang-bot
Copy link
Contributor

dlang-bot commented Jul 21, 2023

Thanks for your pull request and interest in making D better, @dkorpel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
23857 normal backend inliner takes too long on recursive function call

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "stable + dmd#15437"

@dkorpel
Copy link
Contributor Author

dkorpel commented Jul 21, 2023

Huh, test23307 needs backend inlining or it fails the assert.

#14733 says:

It's working for me, so just adding the test case.

Looks like there's still a bug there.

@maxhaton
Copy link
Member

Target stable.

Also is there not a inclining heuristic that can be adjusted?

@ljmf00
Copy link
Member

ljmf00 commented Jul 21, 2023

Huh, test23307 needs backend inlining or it fails the assert.

That seems weird. We shouldn't have a testcase that only works with the inliner.

@dkorpel
Copy link
Contributor Author

dkorpel commented Jul 21, 2023

That seems weird. We shouldn't have a testcase that only works with the inliner.

The issue reported it only happens with dmd -O -inline, so those were set as REQUIRED_ARGS

@ljmf00
Copy link
Member

ljmf00 commented Jul 21, 2023

The issue reported it only happens with dmd -O -inline, so those were set as REQUIRED_ARGS

Conceptually, the inliner doesn't change the behavior of the program. Having it or not should behave exactly the same. Its a bug on the codegen. If we are asserting codegen execution, we shouldn't enforce it to pass only with -inline on or off, exclusively. We should permute the arguments, in most of the cases.

@ljmf00
Copy link
Member

ljmf00 commented Jul 21, 2023

Why do we even use this backend anyway :(

@maxhaton
Copy link
Member

maxhaton commented Jul 21, 2023 via email

@dkorpel dkorpel changed the base branch from master to stable July 21, 2023 17:27
@@ -0,0 +1,24 @@
/*
REQUIRED_ARGS: -O -inline
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

permute these flags, please

@WalterBright
Copy link
Member

WalterBright commented Jul 23, 2023

I'd rather the problem was identified and fixed rather than disabling things.

@WalterBright
Copy link
Member

#15447 doesn't disable the inliner

@dkorpel
Copy link
Contributor Author

dkorpel commented Jul 23, 2023

I'd rather the problem was identified and fixed rather than disabling things.

Of course. I only disable faulty optimizations when they don't get fixed (I emailed you about this bug 3 months ago), because correctness is more important than generation of fast code, especially with dmd. Unlike ldc and gdc, dmd is known to generate code fast, but not fast code.

@dkorpel
Copy link
Contributor Author

dkorpel commented Jul 23, 2023

Superseded by #15447

@dkorpel dkorpel closed this Jul 23, 2023
@WalterBright
Copy link
Member

I emailed you about this bug 3 months ago

I obviously missed that. Oops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend glue code, optimizer, code generation Bug Fix
Projects
None yet
5 participants