From 782d3c21196ad6bcc4f398315f55301a9a806eed Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Fri, 19 Jan 2024 00:20:28 +0100 Subject: [PATCH] JIT: Skip `BBJ_CALLFINALLYRET` in `BasicBlock::VisitEHSuccs` We currently skip yielding EH successors of BBJ_CALLFINALLYRET nodes in `BasicBlock::VisitAllSuccs`. `BasicBlock::VisitEHSuccs` should be consistent with this. --- src/coreclr/jit/compiler.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/compiler.hpp b/src/coreclr/jit/compiler.hpp index 4f10b648efb549..e070b33da7ef8a 100644 --- a/src/coreclr/jit/compiler.hpp +++ b/src/coreclr/jit/compiler.hpp @@ -572,6 +572,13 @@ static BasicBlockVisit VisitEHSuccs(Compiler* comp, BasicBlock* block, TFunc fun template BasicBlockVisit BasicBlock::VisitEHSuccs(Compiler* comp, TFunc func) { + // These are "pseudo-blocks" and control never actually flows into them + // (codegen directly jumps to its successor after finally calls). + if (KindIs(BBJ_CALLFINALLYRET)) + { + return BasicBlockVisit::Continue; + } + return ::VisitEHSuccs(comp, this, func); } @@ -608,7 +615,8 @@ BasicBlockVisit BasicBlock::VisitAllSuccs(Compiler* comp, TFunc func) return ::VisitEHSuccs(comp, this, func); case BBJ_CALLFINALLYRET: - // No exceptions can occur in this paired block; skip its normal EH successors. + // These are "pseudo-blocks" and control never actually flows into them + // (codegen directly jumps to its successor after finally calls). return func(bbTarget); case BBJ_EHCATCHRET: