@@ -847,11 +847,11 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
847
847
// * makes the current relop redundant;
848
848
// * can safely and profitably forward substituted to the jump.
849
849
//
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 ;
855
855
856
856
const ValueNumStore::VN_RELATION_KIND vnRelations[] = {ValueNumStore::VN_RELATION_KIND::VRK_Same,
857
857
ValueNumStore::VN_RELATION_KIND::VRK_Reverse,
@@ -984,8 +984,9 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
984
984
// If the normal liberal VN of RHS is the normal liberal VN of the current tree, or is "related",
985
985
// consider forward sub.
986
986
//
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;
989
990
990
991
for (auto vnRelation : vnRelations)
991
992
{
@@ -1058,8 +1059,9 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
1058
1059
}
1059
1060
1060
1061
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;
1063
1065
}
1064
1066
1065
1067
if (candidateTree == nullptr )
@@ -1088,8 +1090,8 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
1088
1090
// If we need the reverse compare, make it so.
1089
1091
// We also need to set a proper VN.
1090
1092
//
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))
1093
1095
{
1094
1096
// Copy the vn info as it will be trashed when we change the oper.
1095
1097
//
0 commit comments