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

gh-93678: apply remove_redundant_jumps in optimize_cfg #96274

Merged
merged 8 commits into from
Sep 1, 2022

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Aug 25, 2022

Fixes #93678.

Apply remove_redundant_jumps in optimise_cfg because it belongs there. Later in move_cold_blocks_to_end, we may need to apply it again.

Added an assertion just before assembly stage that there are no redundant jumps.

Also tidy up an unrelated error handling issue I spotted.

@iritkatriel iritkatriel added type-feature A feature request or enhancement tests Tests in the Lib/test dir skip news interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Aug 25, 2022
Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

One minor refactoring suggestion.
Otherwise, looks good.

@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 30, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit d0ffa15 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 30, 2022
@iritkatriel
Copy link
Member Author

One minor refactoring suggestion.
Otherwise, looks good.

So the way it is now, the Gentoo Non-Debug build fails because no_redundant_jumps is not defined:

Python/compile.c:8647:12: error: implicit declaration of function ‘no_redundant_jumps’; did you mean ‘remove_redundant_jumps’? [-Werror=implicit-function-declaration]
 8647 |     assert(no_redundant_jumps(g));
      |            ^~~~~~~~~~~~~~~~~~

If I remove the #ifdef Py_DEBUG from the definition of no_redundant_jumps then I get warnings about it not being used on my local build.

@iritkatriel
Copy link
Member Author

@markshannon how about this version?

@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 30, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit e47688a 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 30, 2022
@iritkatriel
Copy link
Member Author

@markshannon how about this version?

Buildbots are fine with it.

@markshannon
Copy link
Member

I'd rather fix the underlying issue.
Why does the Gentoo Non-Debug build have asserts on? That doesn't sound like non-debug to me.

@markshannon
Copy link
Member

Changing the #ifdef Py_DEBUG to #ifndef NDEBUG should work, but I thought #ifdef Py_DEBUG implied #ifndef NDEBUG ande vice-versa.

Am I wrong, or the gentoo non-debug build mis-configured somehow?

@gpshead
Copy link
Member

gpshead commented Aug 31, 2022

NDEBUG can always be used independent of Py_DEBUG. (ex: we regularly build Python and the world -UNDEBUG mode at work in the default build that people test against)

@gpshead
Copy link
Member

gpshead commented Aug 31, 2022

@iritkatriel iritkatriel added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 31, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 065d97d 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 31, 2022
@markshannon markshannon self-requested a review September 1, 2022 09:58
@iritkatriel iritkatriel merged commit 894cafd into python:main Sep 1, 2022
@iritkatriel iritkatriel deleted the optimize_stage branch October 18, 2022 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) skip news tests Tests in the Lib/test dir type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Direct unit tests for compiler optimisations
5 participants