Skip to content

Commit

Permalink
[onert] Use getUses() copy instead of reference
Browse files Browse the repository at this point in the history
This commit fixes the problem that occurs in loop traversal due to
change of list by using copy instead of reference.

ONE-DCO-1.0-Signed-off-by: Jiyoung Yun <[email protected]>
  • Loading branch information
jyoungyun committed Sep 4, 2024
1 parent c66e299 commit 4469012
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void TrainableConstantInsertionPass::callback(const ir::OperationIndex &node_ind
continue;

// Insert new operands for shared constant except for the current node.
const auto &uses = object.getUses();
const auto uses(object.getUses());
for (const auto &use_index : uses)
{
if (use_index == node_index)
Expand Down
2 changes: 1 addition & 1 deletion runtime/onert/core/src/ir/train/UseDefGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void UseDefGenerator::initForForwardingNodes()
}

assert(_training_usedefs.at(forwarding_operand_index).getTrainingUses().size() == 0);
const auto &uses = operand.getUses();
const auto uses(operand.getUses());
for (const auto &use : uses)
insertUse(forwarding_operand_index, TrainingOperationIndex{use, is_forward});
});
Expand Down

0 comments on commit 4469012

Please sign in to comment.