From d0366d6afd5ed323a4c4956899b8f60d5db736d8 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Thu, 19 May 2022 18:51:11 -0700 Subject: [PATCH] fix constant case --- src/coreclr/jit/jitconfigvalues.h | 1 + src/coreclr/jit/redundantbranchopts.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/jitconfigvalues.h b/src/coreclr/jit/jitconfigvalues.h index f1f1be807f4b2..b345c7e4323d1 100644 --- a/src/coreclr/jit/jitconfigvalues.h +++ b/src/coreclr/jit/jitconfigvalues.h @@ -400,6 +400,7 @@ CONFIG_INTEGER(JitDoLoopHoisting, W("JitDoLoopHoisting"), 1) // Perform loop h CONFIG_INTEGER(JitDoLoopInversion, W("JitDoLoopInversion"), 1) // Perform loop inversion on "for/while" loops CONFIG_INTEGER(JitDoRangeAnalysis, W("JitDoRangeAnalysis"), 1) // Perform range check analysis CONFIG_INTEGER(JitDoRedundantBranchOpts, W("JitDoRedundantBranchOpts"), 1) // Perform redundant branch optimizations + CONFIG_INTEGER(JitDoSsa, W("JitDoSsa"), 1) // Perform Static Single Assignment (SSA) numbering on the variables CONFIG_INTEGER(JitDoValueNumber, W("JitDoValueNumber"), 1) // Perform value numbering on method expressions diff --git a/src/coreclr/jit/redundantbranchopts.cpp b/src/coreclr/jit/redundantbranchopts.cpp index c268623bc2754..d46e2f9781d0a 100644 --- a/src/coreclr/jit/redundantbranchopts.cpp +++ b/src/coreclr/jit/redundantbranchopts.cpp @@ -129,7 +129,7 @@ bool Compiler::optRedundantBranch(BasicBlock* const block) // if (vnStore->IsVNConstant(treeNormVN)) { - relopValue = vnStore->VNZeroForType(TYP_INT) ? 0 : 1; + relopValue = (treeNormVN == vnStore->VNZeroForType(TYP_INT)) ? 0 : 1; } const ValueNumStore::VN_RELATION_KIND vnRelations[] = {ValueNumStore::VN_RELATION_KIND::VRK_Same,