@@ -787,10 +787,8 @@ static void findConstants(IRSimilarityCandidate &C, DenseSet<unsigned> &NotSame,
787
787
// global value numbering.
788
788
unsigned GVN = *C.getGVN (V);
789
789
if (isa<Constant>(V))
790
- if (NotSame.contains (GVN) && ! Seen.contains (GVN)) {
790
+ if (NotSame.contains (GVN) && Seen.insert (GVN). second )
791
791
Inputs.push_back (GVN);
792
- Seen.insert (GVN);
793
- }
794
792
}
795
793
}
796
794
}
@@ -814,8 +812,9 @@ static void mapInputsToGVNs(IRSimilarityCandidate &C,
814
812
// replacement.
815
813
for (Value *Input : CurrentInputs) {
816
814
assert (Input && " Have a nullptr as an input" );
817
- if (OutputMappings.contains (Input))
818
- Input = OutputMappings.find (Input)->second ;
815
+ auto It = OutputMappings.find (Input);
816
+ if (It != OutputMappings.end ())
817
+ Input = It->second ;
819
818
assert (C.getGVN (Input) && " Could not find a numbering for the given input" );
820
819
EndInputNumbers.push_back (*C.getGVN (Input));
821
820
}
@@ -836,8 +835,9 @@ remapExtractedInputs(const ArrayRef<Value *> ArgInputs,
836
835
// Get the global value number for each input that will be extracted as an
837
836
// argument by the code extractor, remapping if needed for reloaded values.
838
837
for (Value *Input : ArgInputs) {
839
- if (OutputMappings.contains (Input))
840
- Input = OutputMappings.find (Input)->second ;
838
+ auto It = OutputMappings.find (Input);
839
+ if (It != OutputMappings.end ())
840
+ Input = It->second ;
841
841
RemappedArgInputs.insert (Input);
842
842
}
843
843
}
0 commit comments