From 9e5e4220c67662eddc6627014034ddad4585e30f Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Wed, 3 Aug 2022 13:40:00 -0700 Subject: [PATCH] keep looking unless there is no path --- src/coreclr/jit/redundantbranchopts.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/redundantbranchopts.cpp b/src/coreclr/jit/redundantbranchopts.cpp index 7613b5365bf18..598c2250fcab3 100644 --- a/src/coreclr/jit/redundantbranchopts.cpp +++ b/src/coreclr/jit/redundantbranchopts.cpp @@ -559,7 +559,7 @@ bool Compiler::optRedundantBranch(BasicBlock* const block) relopValue = relopIsFalse ? 0 : 1; break; } - else + else if (!falseReaches && !trueReaches) { // No apparent path from the dominating BB. // @@ -572,8 +572,15 @@ bool Compiler::optRedundantBranch(BasicBlock* const block) // // No point in looking further up the tree. // + JITDUMP("inference failed -- no apparent path, will stop looking\n"); break; } + else + { + // Keep looking up the dom tree + // + JITDUMP("inference failed -- will keep looking higher\n"); + } } } }