Skip to content

Commit 333ffaf

Browse files
committed
llvm-reduce: Trim includes and avoid using namespace in a header
1 parent c919ea5 commit 333ffaf

16 files changed

+49
-12
lines changed

llvm/tools/llvm-reduce/DeltaManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include "deltas/RunIRPasses.h"
5050
#include "deltas/SimplifyInstructions.h"
5151
#include "deltas/StripDebugInfo.h"
52+
#include "llvm/ADT/SmallSet.h"
5253
#include "llvm/Support/CommandLine.h"
5354

5455
using namespace llvm;

llvm/tools/llvm-reduce/ReducerWorkItem.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
#include "llvm/Transforms/Utils/Cloning.h"
3535
#include <optional>
3636

37+
using namespace llvm;
38+
39+
ReducerWorkItem::ReducerWorkItem() = default;
40+
ReducerWorkItem::~ReducerWorkItem() = default;
41+
3742
extern cl::OptionCategory LLVMReduceOptions;
3843
static cl::opt<std::string> TargetTriple("mtriple",
3944
cl::desc("Set the target triple"),

llvm/tools/llvm-reduce/ReducerWorkItem.h

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
#ifndef LLVM_TOOLS_LLVM_REDUCE_REDUCERWORKITEM_H
1010
#define LLVM_TOOLS_LLVM_REDUCE_REDUCERWORKITEM_H
1111

12-
#include "llvm/Bitcode/BitcodeReader.h"
13-
#include "llvm/CodeGen/MachineFunction.h"
14-
#include "llvm/CodeGen/MachineModuleInfo.h"
1512
#include "llvm/IR/Module.h"
16-
#include "llvm/IR/ModuleSummaryIndex.h"
17-
#include "llvm/Target/TargetMachine.h"
13+
#include <memory>
1814

19-
using namespace llvm;
15+
namespace llvm {
16+
class LLVMContext;
17+
class MachineModuleInfo;
18+
class raw_ostream;
19+
class TargetMachine;
20+
class TestRunner;
21+
struct BitcodeLTOInfo;
2022

2123
class ReducerWorkItem {
2224
public:
@@ -41,18 +43,27 @@ class ReducerWorkItem {
4143
return isMIR() ? computeMIRComplexityScore() : computeIRComplexityScore();
4244
}
4345

46+
ReducerWorkItem();
47+
~ReducerWorkItem();
48+
ReducerWorkItem(ReducerWorkItem &) = delete;
49+
ReducerWorkItem(ReducerWorkItem &&) = default;
50+
4451
private:
4552
uint64_t computeIRComplexityScore() const;
4653
uint64_t computeMIRComplexityScore() const;
4754
};
55+
} // namespace llvm
4856

49-
std::pair<std::unique_ptr<ReducerWorkItem>, bool>
50-
parseReducerWorkItem(StringRef ToolName, StringRef Filename, LLVMContext &Ctxt,
51-
std::unique_ptr<TargetMachine> &TM, bool IsMIR);
57+
std::pair<std::unique_ptr<llvm::ReducerWorkItem>, bool>
58+
parseReducerWorkItem(llvm::StringRef ToolName, llvm::StringRef Filename,
59+
llvm::LLVMContext &Ctxt,
60+
std::unique_ptr<llvm::TargetMachine> &TM, bool IsMIR);
5261

53-
std::unique_ptr<ReducerWorkItem>
54-
cloneReducerWorkItem(const ReducerWorkItem &MMM, const TargetMachine *TM);
62+
std::unique_ptr<llvm::ReducerWorkItem>
63+
cloneReducerWorkItem(const llvm::ReducerWorkItem &MMM,
64+
const llvm::TargetMachine *TM);
5565

56-
bool verifyReducerWorkItem(const ReducerWorkItem &MMM, raw_fd_ostream *OS);
66+
bool verifyReducerWorkItem(const llvm::ReducerWorkItem &MMM,
67+
llvm::raw_fd_ostream *OS);
5768

5869
#endif

llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "ReduceDIMetadata.h"
1515
#include "Delta.h"
1616
#include "llvm/ADT/Sequence.h"
17+
#include "llvm/ADT/SetVector.h"
18+
#include "llvm/ADT/SmallSet.h"
1719
#include "llvm/ADT/SmallVector.h"
1820
#include "llvm/IR/DebugInfoMetadata.h"
1921
#include "llvm/IR/InstIterator.h"

llvm/tools/llvm-reduce/deltas/ReduceIRReferences.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "ReduceIRReferences.h"
1616
#include "Delta.h"
1717
#include "llvm/CodeGen/MachineFrameInfo.h"
18+
#include "llvm/CodeGen/MachineFunction.h"
19+
#include "llvm/CodeGen/MachineModuleInfo.h"
1820

1921
using namespace llvm;
2022

llvm/tools/llvm-reduce/deltas/ReduceInstructionFlags.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "llvm/IR/Instructions.h"
1818
#include "llvm/IR/Operator.h"
1919

20+
using namespace llvm;
21+
2022
static void reduceFlagsInModule(Oracle &O, ReducerWorkItem &WorkItem) {
2123
for (Function &F : WorkItem.getModule()) {
2224
for (Instruction &I : instructions(F)) {

llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "ReduceInstructionFlagsMIR.h"
1515
#include "llvm/CodeGen/MachineFunction.h"
16+
#include "llvm/CodeGen/MachineModuleInfo.h"
1617
using namespace llvm;
1718

1819
static void removeFlagsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {

llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/CodeGen/MachineDominators.h"
1919
#include "llvm/CodeGen/MachineFunction.h"
2020
#include "llvm/CodeGen/MachineFunctionPass.h"
21+
#include "llvm/CodeGen/MachineModuleInfo.h"
2122
#include "llvm/CodeGen/MachineRegisterInfo.h"
2223
#include "llvm/CodeGen/TargetInstrInfo.h"
2324

llvm/tools/llvm-reduce/deltas/ReduceInvokes.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "llvm/IR/Instructions.h"
1616
#include "llvm/Transforms/Utils/Local.h"
1717

18+
using namespace llvm;
19+
1820
static void reduceInvokesInFunction(Oracle &O, Function &F) {
1921
for (BasicBlock &BB : F) {
2022
InvokeInst *Invoke = dyn_cast<InvokeInst>(BB.getTerminator());

llvm/tools/llvm-reduce/deltas/ReduceMemoryOperations.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include "llvm/IR/Instructions.h"
1313
#include "llvm/IR/IntrinsicInst.h"
1414

15+
using namespace llvm;
16+
1517
static void removeVolatileInFunction(Oracle &O, Function &F) {
1618
LLVMContext &Ctx = F.getContext();
1719
for (Instruction &I : instructions(F)) {

llvm/tools/llvm-reduce/deltas/ReduceOpcodes.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "llvm/IR/Intrinsics.h"
2020
#include "llvm/IR/IntrinsicsAMDGPU.h"
2121

22+
using namespace llvm;
23+
2224
// Assume outgoing undef arguments aren't relevant.
2325
// TODO: Maybe skip any trivial constant arguments.
2426
static bool shouldIgnoreArgument(const Value *V) {

llvm/tools/llvm-reduce/deltas/ReduceRegisterDefs.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "ReduceRegisterDefs.h"
1515
#include "llvm/CodeGen/MachineFunction.h"
16+
#include "llvm/CodeGen/MachineModuleInfo.h"
1617
#include "llvm/CodeGen/MachineRegisterInfo.h"
1718
#include "llvm/CodeGen/TargetInstrInfo.h"
1819

llvm/tools/llvm-reduce/deltas/ReduceRegisterMasks.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "ReduceRegisterMasks.h"
1515
#include "llvm/CodeGen/MachineFunction.h"
16+
#include "llvm/CodeGen/MachineModuleInfo.h"
1617
#include "llvm/CodeGen/MachineRegisterInfo.h"
1718

1819
using namespace llvm;

llvm/tools/llvm-reduce/deltas/ReduceRegisterUses.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "ReduceRegisterUses.h"
1515
#include "llvm/CodeGen/MachineFunction.h"
16+
#include "llvm/CodeGen/MachineModuleInfo.h"
1617
#include "llvm/CodeGen/MachineRegisterInfo.h"
1718

1819
using namespace llvm;

llvm/tools/llvm-reduce/deltas/ReduceVirtualRegisters.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "ReduceVirtualRegisters.h"
1515
#include "Delta.h"
16+
#include "llvm/CodeGen/MachineModuleInfo.h"
1617
#include "llvm/CodeGen/MachineRegisterInfo.h"
1718

1819
using namespace llvm;

llvm/tools/llvm-reduce/llvm-reduce.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
#include "DeltaManager.h"
1818
#include "ReducerWorkItem.h"
1919
#include "TestRunner.h"
20+
#include "llvm/Bitcode/BitcodeReader.h"
2021
#include "llvm/CodeGen/CommandFlags.h"
2122
#include "llvm/Support/CommandLine.h"
2223
#include "llvm/Support/InitLLVM.h"
24+
#include "llvm/Support/MemoryBufferRef.h"
2325
#include "llvm/Support/Process.h"
2426
#include "llvm/Support/WithColor.h"
2527
#include "llvm/Support/raw_ostream.h"

0 commit comments

Comments
 (0)