Skip to content

Commit

Permalink
Prevent MVC reduction in astoreEvaluator if symref is unresolved
Browse files Browse the repository at this point in the history
The `astoreEvaluator`, more precisely the `astoreHelper` has a path in
which it is trying to identify the following tree pattern:

```
astore <x>
  aload <y>
```

and tries to generate an `MVC` instruction to perform the store. The
problem with this is that it seems to generate a memory reference from
the `node` only for the purposes of testing whether it has an index
register (which it by the way cannot know until the memory reference is
used within an instruction). The act of generating a memory reference
is not side-effect free as the symref could have been unresolved and as
such various metadata can be generated.

The `astoreHelper` then goes ahead and creates another memory reference
from the node and uses that for the `MVC` instruction. This means the
metadata for handling unresolved symrefs could have been generated
twice.

Similarly to `directMemoryStoreHelper` we simply prevent this `MVC`
reduction if the symref is unresolved.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
  • Loading branch information
fjeremic authored and r30shah committed Nov 24, 2020
1 parent 64c519b commit 81f8f75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/z/codegen/OMRTreeEvaluator.cpp
Expand Up @@ -5693,7 +5693,7 @@ astoreHelper(TR::Node * node, TR::CodeGenerator * cg)
}
}
// aload is the child, then don't evaluate the child, generate MVC to move directly among memory
else if(!node->getOpCode().isIndirect() &&
else if(!node->getOpCode().isIndirect() && !node->getSymbolReference()->isUnresolved() &&
valueChild->getOpCodeValue() == TR::aload &&
valueChild->getReferenceCount() == 1 &&
valueChild->getRegister() == NULL &&
Expand Down

0 comments on commit 81f8f75

Please sign in to comment.