[llvm] a838043 - [llvm] Use contains (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 11 11:46:22 PDT 2022


Author: Kazu Hirata
Date: 2022-06-11T11:46:16-07:00
New Revision: a838043f387139cd470a3d2aa450ae6e04abd3c7

URL: https://github.com/llvm/llvm-project/commit/a838043f387139cd470a3d2aa450ae6e04abd3c7
DIFF: https://github.com/llvm/llvm-project/commit/a838043f387139cd470a3d2aa450ae6e04abd3c7.diff

LOG: [llvm] Use contains (NFC)

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/HexagonHazardRecognizer.cpp
    llvm/lib/Transforms/IPO/IROutliner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/HexagonHazardRecognizer.cpp b/llvm/lib/Target/Hexagon/HexagonHazardRecognizer.cpp
index e2215c9900d04..577eccd25c19f 100644
--- a/llvm/lib/Target/Hexagon/HexagonHazardRecognizer.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonHazardRecognizer.cpp
@@ -106,7 +106,7 @@ bool HexagonHazardRecognizer::isNewStore(MachineInstr &MI) {
   if (!TII->mayBeNewStore(MI))
     return false;
   MachineOperand &MO = MI.getOperand(MI.getNumOperands() - 1);
-  return (MO.isReg() && RegDefs.count(MO.getReg()) != 0);
+  return MO.isReg() && RegDefs.contains(MO.getReg());
 }
 
 void HexagonHazardRecognizer::EmitInstruction(SUnit *SU) {

diff  --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index 2979b9d08f07f..2ecfd5270a5d4 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -1183,14 +1183,14 @@ static Optional<unsigned> getGVNForPHINode(OutlinableRegion &Region,
     // adding an extra input.  We ignore this case for now, and so ignore the
     // region.
     Optional<unsigned> OGVN = Cand.getGVN(Incoming);
-    if (!OGVN.hasValue() && (Blocks.find(IncomingBlock) != Blocks.end())) {
+    if (!OGVN.hasValue() && Blocks.contains(IncomingBlock)) {
       Region.IgnoreRegion = true;
       return None;
     }
 
     // If the incoming block isn't in the region, we don't have to worry about
     // this incoming value.
-    if (Blocks.find(IncomingBlock) == Blocks.end())
+    if (!Blocks.contains(IncomingBlock))
       continue;
 
     // Collect the canonical numbers of the values in the PHINode.
@@ -1701,7 +1701,7 @@ findOrCreatePHIInBlock(PHINode &PN, OutlinableRegion &Region,
   for (PHINode &CurrPN : OverallPhiBlock->phis()) {
     // If this PHINode has already been matched to another PHINode to be merged,
     // we skip it.
-    if (UsedPHIs.find(&CurrPN) != UsedPHIs.end())
+    if (UsedPHIs.contains(&CurrPN))
       continue;
 
     CurrentCanonNums.clear();


        


More information about the llvm-commits mailing list