Skip to content

Commit

Permalink
Fix the badIlOp node generated by RegDepCopyRemoval
Browse files Browse the repository at this point in the history
For creating a fresh copy for RegDepCopyRemoval optimization, there was
a case when a regLoad is under PassThrough node in which case we would
not have corresponding regStore. To handle this case we were creating a
regStore by getting the type from PassThrough node which would cause
badIlOp. This commit fixes that issue.

Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
  • Loading branch information
r30shah committed Nov 3, 2020
1 parent 84e10c3 commit a19ea6a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/optimizer/RegDepCopyRemoval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,13 @@ TR::RegDepCopyRemoval::makeFreshCopy(TR_GlobalRegisterNumber reg)
TR_ASSERT_FATAL_WITH_NODE(dep.node,
dep.node->getOpCode().isLoadReg()
|| (dep.node->getOpCodeValue() == TR::PassThrough
&& dep.node->getFirstChild()->getOpCode().isLoadReg()
&& dep.node->getGlobalRegisterNumber() == dep.node->getFirstChild()->getGlobalRegisterNumber()),
&& dep.value->getOpCode().isLoadReg()
&& dep.node->getGlobalRegisterNumber() == dep.value->getGlobalRegisterNumber()),
"Only PassThrough (with corresponding regStore appeared before or using same Global Register as child) or regLoad nodes are expected as children of GlRegDeps.");
choice.regStoreNode = TR::Node::create(dep.node, comp()->il.opCodeForRegisterStore(dep.node->getDataType()), 1, copyNode);
choice.regStoreNode = TR::Node::create(dep.node, comp()->il.opCodeForRegisterStore(dep.value->getDataType()), 1, copyNode);
_treetop->insertBefore(TR::TreeTop::create(comp(), choice.regStoreNode));
choice.regStoreNode->setGlobalRegisterNumber(dep.node->getGlobalRegisterNumber());
choice.regStoreNode->setRegLoadStoreSymbolReference(dep.node->getRegLoadStoreSymbolReference());
choice.regStoreNode->setRegLoadStoreSymbolReference(dep.value->getRegLoadStoreSymbolReference());
}
else
{
Expand Down

0 comments on commit a19ea6a

Please sign in to comment.