From d792c27353bd2bb6913c5231a4c707264e50904e Mon Sep 17 00:00:00 2001 From: Tobias Tebbi Date: Thu, 22 Sep 2022 13:17:37 +0200 Subject: [PATCH] [turboshaft] fix single-block loop bug Bug: v8:12783 Change-Id: Ia4aaf245428dd63be09a33bfb684f0573f6b9296 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913084 Reviewed-by: Manos Koukoutos Auto-Submit: Tobias Tebbi Commit-Queue: Tobias Tebbi Cr-Commit-Position: refs/heads/main@{#83420} --- src/compiler/turboshaft/optimization-phase.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/turboshaft/optimization-phase.h b/src/compiler/turboshaft/optimization-phase.h index 12a3b97911..86f4920b17 100644 --- a/src/compiler/turboshaft/optimization-phase.h +++ b/src/compiler/turboshaft/optimization-phase.h @@ -290,12 +290,13 @@ struct OptimizationPhase::Impl { V8_INLINE OpIndex ReduceGoto(const GotoOp& op) { Block* destination = MapToNewGraph(op.destination->index()); + assembler.current_block()->SetOrigin(current_input_block); + assembler.Goto(destination); if (destination->IsBound()) { DCHECK(destination->IsLoop()); FixLoopPhis(destination); } - assembler.current_block()->SetOrigin(current_input_block); - return assembler.Goto(destination); + return OpIndex::Invalid(); } V8_INLINE OpIndex ReduceBranch(const BranchOp& op) { Block* if_true = MapToNewGraph(op.if_true->index());