Skip to content

Commit

Permalink
Handle PassThrough in ILChildValidator
Browse files Browse the repository at this point in the history
It is possible to have a PassThrough as a child node of regular node.
When we are validating the children of a node, we need to make sure that
when we see a PassThrough child, it gets real child that represents the
node and check its type with parent.

Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
  • Loading branch information
r30shah committed Sep 2, 2020
1 parent 104d2c3 commit e2bb845
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions compiler/ras/ILValidationRules.cpp
Expand Up @@ -446,6 +446,19 @@ void TR::ValidateChildTypes::validate(TR::Node *node)
auto childOpcode = node->getChild(i)->getOpCode();
if (childOpcode.getOpCodeValue() != TR::GlRegDeps)
{
/**
* It is possible that a PassThrough is set as child of a node, which
* is not real child. We need to traverse through child of PassThrough
* till we get the real child to validate.
*/
if (opcode.isStoreReg() && childOpcode.getOpCodeValue() == TR::PassThrough)
{
TR::Node *childNode = node->getChild(i);
while (childNode->getOpCodeValue() == TR::PassThrough)
childNode = childNode->getFirstChild();
childOpcode = childNode->getOpCode();
}

const auto expChildType = opcode.expectedChildType(i);
const auto actChildType = childOpcode.getDataType().getDataType();
const auto expChildTypeName = (expChildType >= TR::NumTypes) ?
Expand Down

0 comments on commit e2bb845

Please sign in to comment.