From 78cd82e6165d9697e2a532ec57a02e32a69ef418 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Wed, 3 Jul 2024 10:48:01 +0200 Subject: [PATCH] JIT: Compute EH liveness on all blocks instead of RPO blocks (#104321) Since we can have blocks whose control flow we do not model (like throw helpers) we need to consider all blocks when computing the `exceptVars` and `finallyVars` sets. Fix #104315 --- src/coreclr/jit/liveness.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreclr/jit/liveness.cpp b/src/coreclr/jit/liveness.cpp index e014cb3919c77a..a9f566bd37bef8 100644 --- a/src/coreclr/jit/liveness.cpp +++ b/src/coreclr/jit/liveness.cpp @@ -1783,9 +1783,8 @@ void Compiler::fgInterBlockLocalVarLiveness() VARSET_TP exceptVars(VarSetOps::MakeEmpty(this)); // vars live on entry to a handler VARSET_TP finallyVars(VarSetOps::MakeEmpty(this)); // vars live on exit of a 'finally' block - for (unsigned i = m_dfsTree->GetPostOrderCount(); i != 0; i--) + for (BasicBlock* block : Blocks()) { - BasicBlock* block = m_dfsTree->GetPostOrder(i - 1); if (block->hasEHBoundaryIn()) { // Note the set of variables live on entry to exception handler.