1 //===- ReduceInstructionFlagsMIR.cpp - Specialized Delta Pass -------------===//
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
7 //===----------------------------------------------------------------------===//
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"
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())
33 void llvm::reduceInstructionFlagsMIRDeltaPass(TestRunner
&Test
) {
34 runDeltaPass(Test
, removeFlagsFromModule
, "Reducing Instruction Flags");