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

Remove unnecessary idiom recognition assertions #17949

Merged

Conversation

jdmpapin
Copy link
Contributor

@jdmpapin jdmpapin commented Aug 14, 2023

There are uses of TR_ASSERT() in idiom recognition that check for cases that are not necessarily impossible and that are handled conservatively in builds where TR_ASSERT() is not checked. Assertions are not a good way to detect and report these cases, since assertion failure is not likely to be due to a bug.

This commit removes a number of these assertions. Now the conservative logic will apply in all builds. When it does, a static debug counter will be incremented, and (when tracing idiom recognition) a message will be printed to the log.

Anyone who wants to look for transformations that have been prevented due to incomplete support for a particular case can use the new static debug counters.

Additionally, use dumpOptDetails() to trace when a transformer fails. In that case it's misleading to leave the log showing only the message from performTransformation().

Fixes #17819

Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

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

I think your change looks good - just one minor question/comment.

I notice there are at least four other places in Idiom Recognition that have a TR_ASSERT that says "not implemented yet". As the goal in the short-term is to get PROD_WITH_ASSUMES working for sanity.functional test runs, fixing just this one is fine for now, but may I ask you to open a follow up issue to track cleaning up the remaining four - assuming that they also describe situations that can be safely ignored?

runtime/compiler/optimizer/IdiomRecognition.cpp Outdated Show resolved Hide resolved
@jdmpapin
Copy link
Contributor Author

I'll generalize this PR at least a bit

There are uses of TR_ASSERT() in idiom recognition that check for cases
that are not necessarily impossible and that are handled conservatively
in builds where TR_ASSERT() is not checked. Assertions are not a good
way to detect and report these cases, since assertion failure is not
likely to be due to a bug.

This commit removes a number of these assertions. Now the conservative
logic will apply in all builds. When it does, a static debug counter
will be incremented, and (when tracing idiom recognition) a message will
be printed to the log.

Anyone who wants to look for transformations that have been prevented
due to incomplete support for a particular case can use the new static
debug counters.

Additionally, use dumpOptDetails() to trace when a transformer fails.
In that case it's misleading to leave the log showing only the message
from performTransformation().
@jdmpapin jdmpapin force-pushed the analyzeBoolTable-unrecognized-if-op branch from 17cd1a1 to 6ef55f5 Compare August 16, 2023 20:54
@jdmpapin
Copy link
Contributor Author

Updated. Along with some assertions in the transformations, I caught analyzeByteBoolTable() and analyzeCharBoolTable(). What were the other two places you had in mind?

@jdmpapin jdmpapin changed the title Change bool table unrecognized op assertion to static debug counter Remove unnecessary idiom recognition assertions Aug 16, 2023
@hzongaro
Copy link
Member

What were the other two places you had in mind?

I think I miscounted - the third was in analyzeBoolTable, which was the one you originally changed. The fourth is in TR_CISCTransformer::modifyBlockByVersioningCheck, and so far as I can tell, that method is never actually used. Looking at it more closely, I think it represents a real assertion, rather than simply flagging something that was unimplemented.

Thanks for catching the additional changes in the transformations! I'll review your changes.

Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@hzongaro
Copy link
Member

Jenkins test sanity all jdk11,jdk17

@hzongaro
Copy link
Member

Jenkins test sanity zlinux jdk11

@hzongaro
Copy link
Member

Jenkins test sanity jdk17 aarch64_linux

@hzongaro
Copy link
Member

Jenkins test sanity aarch64_linux jdk17

@hzongaro
Copy link
Member

Jenkins test sanity zlinux jdk11

1 similar comment
@hzongaro
Copy link
Member

Jenkins test sanity zlinux jdk11

@hzongaro
Copy link
Member

Jenkins test sanity aarch64_linux jdk17

@hzongaro
Copy link
Member

Jenkins test sanity zlinux jdk11

1 similar comment
@hzongaro
Copy link
Member

Jenkins test sanity zlinux jdk11

@hzongaro
Copy link
Member

Jenkins test sanity zlinux jdk11
Jenkins test sanity aarch64_linux jdk17

@hzongaro
Copy link
Member

Jenkins test sanity zlinux jdk11

@hzongaro
Copy link
Member

Jenkins test sanity aarch64_linux jdk17

@hzongaro hzongaro self-assigned this Aug 20, 2023
@hzongaro hzongaro merged commit ddbabba into eclipse-openj9:master Aug 21, 2023
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assertion failure at openj9/runtime/compiler/optimizer/IdiomRecognition.cpp:6692: false
2 participants