Skip to content

Remove unnecessary idiom recognition assertions - #17949

Merged
hzongaro merged 1 commit into
eclipse-openj9:masterfrom
jdmpapin:analyzeBoolTable-unrecognized-if-op
Aug 21, 2023
Merged

Remove unnecessary idiom recognition assertions#17949
hzongaro merged 1 commit into
eclipse-openj9:masterfrom
jdmpapin:analyzeBoolTable-unrecognized-if-op

Conversation

@jdmpapin

@jdmpapin jdmpapin commented Aug 14, 2023

Copy link
Copy Markdown
Contributor

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

@hzongaro hzongaro left a comment

Copy link
Copy Markdown
Member

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?

Comment thread runtime/compiler/optimizer/IdiomRecognition.cpp Outdated
@jdmpapin

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@hzongaro hzongaro left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

Jenkins test sanity all jdk11,jdk17

@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity zlinux jdk11

@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity jdk17 aarch64_linux

@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity aarch64_linux jdk17

@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity zlinux jdk11

1 similar comment
@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity zlinux jdk11

@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity aarch64_linux jdk17

@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity zlinux jdk11

1 similar comment
@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity zlinux jdk11

@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity zlinux jdk11
Jenkins test sanity aarch64_linux jdk17

@hzongaro

Copy link
Copy Markdown
Member

Jenkins test sanity zlinux jdk11

@hzongaro

Copy link
Copy Markdown
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
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