[llvm] c133fb3 - [CodeGen] Use llvm::is_contained (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 21 10:36:32 PST 2021


Author: Kazu Hirata
Date: 2021-11-21T10:36:20-08:00
New Revision: c133fb321f7ca6083ce15b6aa5bf89de6600e649

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

LOG: [CodeGen] Use llvm::is_contained (NFC)

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveRangeEdit.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveRangeEdit.cpp b/llvm/lib/CodeGen/LiveRangeEdit.cpp
index d91ff734ad8f..f36c33e62da7 100644
--- a/llvm/lib/CodeGen/LiveRangeEdit.cpp
+++ b/llvm/lib/CodeGen/LiveRangeEdit.cpp
@@ -425,15 +425,8 @@ void LiveRangeEdit::eliminateDeadDefs(SmallVectorImpl<MachineInstr *> &Dead,
     // The new intervals would have to be spilled anyway so its not worth it.
     // Also they currently aren't spilled so creating them and not spilling
     // them results in incorrect code.
-    bool BeingSpilled = false;
-    for (unsigned i = 0, e = RegsBeingSpilled.size(); i != e; ++i) {
-      if (VReg == RegsBeingSpilled[i]) {
-        BeingSpilled = true;
-        break;
-      }
-    }
-
-    if (BeingSpilled) continue;
+    if (llvm::is_contained(RegsBeingSpilled, VReg))
+      continue;
 
     // LI may have been separated, create new intervals.
     LI->RenumberValues();


        


More information about the llvm-commits mailing list