@@ -847,11 +847,11 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
847847    //   * makes the current relop redundant;
848848    //   * can safely and profitably forward substituted to the jump.
849849    // 
850-     Statement*                      prevStmt        = stmt;
851-     GenTree*                        candidateTree   = nullptr ;
852-     Statement*                      candidateStmt   = nullptr ;
853-     ValueNumStore::VN_RELATION_KIND vnRelationMatch  = ValueNumStore::VN_RELATION_KIND::VRK_Same;
854-     bool                             sideEffect      = false ;
850+     Statement*                      prevStmt             = stmt;
851+     GenTree*                        candidateTree        = nullptr ;
852+     Statement*                      candidateStmt        = nullptr ;
853+     ValueNumStore::VN_RELATION_KIND candidateVnRelation  = ValueNumStore::VN_RELATION_KIND::VRK_Same;
854+     bool                             sideEffect           = false ;
855855
856856    const  ValueNumStore::VN_RELATION_KIND vnRelations[] = {ValueNumStore::VN_RELATION_KIND::VRK_Same,
857857                                                           ValueNumStore::VN_RELATION_KIND::VRK_Reverse,
@@ -984,8 +984,9 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
984984        //  If the normal liberal VN of RHS is the normal liberal VN of the current tree, or is "related",
985985        //  consider forward sub.
986986        // 
987-         const  ValueNum domCmpVN = vnStore->VNNormalValue (prevTreeRHS->GetVN (VNK_Liberal));
988-         bool            matched  = false ;
987+         const  ValueNum                  domCmpVN        = vnStore->VNNormalValue (prevTreeRHS->GetVN (VNK_Liberal));
988+         bool                             matched         = false ;
989+         ValueNumStore::VN_RELATION_KIND vnRelationMatch = ValueNumStore::VN_RELATION_KIND::VRK_Same;
989990
990991        for  (auto  vnRelation : vnRelations)
991992        {
@@ -1058,8 +1059,9 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
10581059        }
10591060
10601061        JITDUMP ("  -- prev tree is viable candidate for relop fwd sub!\n " 
1061-         candidateTree = prevTreeRHS;
1062-         candidateStmt = prevStmt;
1062+         candidateTree       = prevTreeRHS;
1063+         candidateStmt       = prevStmt;
1064+         candidateVnRelation = vnRelationMatch;
10631065    }
10641066
10651067    if  (candidateTree == nullptr )
@@ -1088,8 +1090,8 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
10881090    //  If we need the reverse compare, make it so.
10891091    //  We also need to set a proper VN.
10901092    // 
1091-     if  ((vnRelationMatch  == ValueNumStore::VN_RELATION_KIND::VRK_Reverse) ||
1092-         (vnRelationMatch  == ValueNumStore::VN_RELATION_KIND::VRK_SwapReverse))
1093+     if  ((candidateVnRelation  == ValueNumStore::VN_RELATION_KIND::VRK_Reverse) ||
1094+         (candidateVnRelation  == ValueNumStore::VN_RELATION_KIND::VRK_SwapReverse))
10931095    {
10941096        //  Copy the vn info as it will be trashed when we change the oper.
10951097        // 
0 commit comments