[clang] Propagate -ftime-report to offload lto (#122143)
[llvm-project.git] / llvm / tools / llvm-reduce / deltas / ReduceInstructionFlagsMIR.cpp
blobf2895b31947ecd1a21178909c5c051bb50c97e12
1 //===- ReduceInstructionFlagsMIR.cpp - Specialized Delta Pass -------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements a function which calls the Generic Delta pass in order
10 // to reduce uninteresting MachineInstr flags from the MachineFunction.
12 //===----------------------------------------------------------------------===//
14 #include "ReduceInstructionFlagsMIR.h"
15 #include "llvm/CodeGen/MachineFunction.h"
16 #include "llvm/CodeGen/MachineModuleInfo.h"
17 using namespace llvm;
19 static void removeFlagsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
20 for (const Function &F : WorkItem.getModule()) {
21 if (auto *MF = WorkItem.MMI->getMachineFunction(F)) {
22 for (MachineBasicBlock &MBB : *MF) {
23 for (MachineInstr &MI : MBB) {
24 // TODO: Should this clear flags individually?
25 if (MI.getFlags() != 0 && !O.shouldKeep())
26 MI.setFlags(0);
33 void llvm::reduceInstructionFlagsMIRDeltaPass(TestRunner &Test) {
34 runDeltaPass(Test, removeFlagsFromModule, "Reducing Instruction Flags");