[llvm] r321028 - [MachineOutliner][NFC] Gardening: use std::any_of instead of bool + loop

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 13:44:53 PST 2017


Author: paquette
Date: Mon Dec 18 13:44:52 2017
New Revision: 321028

URL: http://llvm.org/viewvc/llvm-project?rev=321028&view=rev
Log:
[MachineOutliner][NFC] Gardening: use std::any_of instead of bool + loop

River Riddle suggested to use std::any_of instead of the bool + loop thing on
r320229. This commit does that.


Modified:
    llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp

Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp?rev=321028&r1=321027&r2=321028&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp Mon Dec 18 13:44:52 2017
@@ -4963,16 +4963,9 @@ void AArch64InstrInfo::insertOutlinerEpi
     MachineBasicBlock &MBB, MachineFunction &MF,
     const MachineOutlinerInfo &MInfo) const {
 
-  bool ContainsCalls = false;
-
-  for (MachineInstr &MI : MBB) {
-    if (MI.isCall()) {
-      ContainsCalls = true;
-      break;
-    }
-  }
-
-  if (ContainsCalls) {
+  // Is there a call in the outlined range?
+  if (std::any_of(MBB.instr_begin(), MBB.instr_end(),
+                  [](MachineInstr &MI) { return MI.isCall(); })) {
     // Fix up the instructions in the range, since we're going to modify the
     // stack.
     fixupPostOutline(MBB);




More information about the llvm-commits mailing list