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 DeadTreeElimination for volatile load #4817
Conversation
@andrewcraik could you review again? thanks! |
@genie-omr build all |
static const bool relaxedConditionForSwingingDownVolatile = feGetEnv("TR_relaxedConditionForSwingingDownVolatile") ? true: false; | ||
if (!relaxedConditionForSwingingDownVolatile) | ||
{ | ||
if (!containerNode->getSymbol()->isAuto()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this can be changed to check isAutoOrParm at the very least instead of isAuto. There are also some other accesses that may be ok such as a load of a constant string for example, i.e. you may be able to permit some other cases too that are simple to reason about in that an ordering constraint wrt a volatile access does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified the code to use isAutoOrParm
and check of constant string.
We want a volatile field (both static and instance) access to be a barrier to code motion of other field accesses (to preserve the ordering semantics that are expected from volatile keyword). The way this is enforced in the compiler is to consider volatile accesses as "defs" essentially and relying on the aliasing on the symbol reference to kill other symbol references impacted by the ordering semantics. Defs in the compiler must be either a treetop or the first child under a treetop for optimizations to locate them, i.e. there are optimizations that walk the IL trees only looking at the treetop and first child for potential defs. So if a volatile access was accessed for the first time at an arbitrary spot (level) in a tree (rather than at the treetop level) then it might get missed as a def and this may lead to incorrect optimization. This commit ensures that volatile sym refs are found where the compiler expects defs, namely at the appropriate treetop level. Signed-off-by: Yi Zhang <yizhang@ca.ibm.com>
@genie-omr build all |
1 similar comment
@genie-omr build all |
Tests have passed and reviews are done. I am merging this now. |
We want a volatile field (both static and instance) access to be a
barrier to code motion of other field accesses (to preserve the ordering
semantics that are expected from volatile keyword). The way this is
enforced in the compiler is to consider volatile accesses as "defs"
essentially and relying on the aliasing on the symbol reference to kill
other symbol references impacted by the ordering semantics. Defs in the
compiler must be either a treetop or the first child under a treetop for
optimizations to locate them, i.e. there are optimizations that walk the
IL trees only looking at the treetop and first child for potential defs.
So if a volatile access was accessed for the first time at an arbitrary
spot (level) in a tree (rather than at the treetop level) then it might
get missed as a def and this may lead to incorrect optimization. This
commit ensures that volatile sym refs are found where the compiler
expects defs, namely at the appropriate treetop level.
Signed-off-by: Yi Zhang yizhang@ca.ibm.com