Skip to content

Commit 05f43cf

Browse files
committed
* don't declare var inside if-stmt
1 parent 08bab0b commit 05f43cf

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

src/coreclr/jit/ifconversion.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -607,17 +607,20 @@ bool OptIfConversionDsc::optIfConvert(int* pReachabilityBudget)
607607
}
608608
#endif
609609

610-
if (GenTree* optSelect = TryOptimizeSelect(select->AsConditional()); optSelect != nullptr)
611610
{
612-
select = optSelect;
611+
GenTree* optSelect = TryOptimizeSelect(select->AsConditional());
612+
if (optSelect != nullptr)
613+
{
614+
select = optSelect;
613615

614616
#ifdef DEBUG
615-
JITDUMP("\nSELECT after optimizations:\n");
616-
if (m_compiler->verbose)
617-
{
618-
m_compiler->gtDispTree(select);
619-
}
617+
JITDUMP("\nSELECT after optimizations:\n");
618+
if (m_compiler->verbose)
619+
{
620+
m_compiler->gtDispTree(select);
621+
}
620622
#endif
623+
}
621624
}
622625

623626
#ifdef TARGET_RISCV64
@@ -705,15 +708,20 @@ bool OptIfConversionDsc::optIfConvert(int* pReachabilityBudget)
705708
//
706709
GenTree* OptIfConversionDsc::TryOptimizeSelect(GenTreeConditional* select)
707710
{
708-
if (GenTree* opt = TrySelectToCnsOpCond(select); opt != nullptr)
711+
GenTree* opt = TrySelectToCnsOpCond(select);
712+
if (opt != nullptr)
709713
{
710714
return opt;
711715
}
712-
if (GenTree* opt = TrySelectToLclOpCond(select); opt != nullptr)
716+
717+
opt = TrySelectToLclOpCond(select);
718+
if (opt != nullptr)
713719
{
714720
return opt;
715721
}
716-
if (GenTree* opt = TrySelectToCondOpLcl(select); opt != nullptr)
722+
723+
opt = TrySelectToCondOpLcl(select);
724+
if (opt != nullptr)
717725
{
718726
return opt;
719727
}

0 commit comments

Comments
 (0)