From bd5659e7f413f39c33d9966ff35497fdfbad82ce Mon Sep 17 00:00:00 2001 From: Kevin Langman Date: Wed, 13 Jul 2022 12:38:20 -0400 Subject: [PATCH] Fix an assert in OMR::Power::TreeEvaluator::s2iEvaluator() The s2iEvaluator uses a isLoad() test when deciding between a simple sign extend or generating a load sequence. The isLoad() test returns true for both LoadVar and LoadConst cases and therefore we can get into the load sequence when handling a sconst node child which results in an assert. This PR will change isLoad() to isLoadVar() so that the sconst case will use the simple sign extend path. Signed-off-by: Kevin Langman --- compiler/p/codegen/UnaryEvaluator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/p/codegen/UnaryEvaluator.cpp b/compiler/p/codegen/UnaryEvaluator.cpp index bcc31b43636..aee9e76e6aa 100644 --- a/compiler/p/codegen/UnaryEvaluator.cpp +++ b/compiler/p/codegen/UnaryEvaluator.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2021 IBM Corp. and others + * Copyright (c) 2000, 2022 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -278,7 +278,7 @@ TR::Register *OMR::Power::TreeEvaluator::s2iEvaluator(TR::Node *node, TR::CodeGe TR::Node *child = node->getFirstChild(); TR::Register *trgReg = cg->allocateRegister(); - if (child->getOpCode().isLoad() && !child->getRegister() && child->getReferenceCount() == 1) + if (child->getOpCode().isLoadVar() && !child->getRegister() && child->getReferenceCount() == 1) { TR::LoadStoreHandler::generateLoadNodeSequence(cg, trgReg, child, TR::InstOpCode::lha, 2); }