Skip to content

Commit 04cb5f5

Browse files
jurahulLukacma
authored andcommitted
[NFC][LLVM][CodeGen] Create header file for MIRFSDiscriminator options (llvm#163438)
Extract extern variable declaration into a header per https://discourse.llvm.org/t/rfc-cs-changes-for-standalone-variables/88581
1 parent 79efa92 commit 04cb5f5

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===----------------------------------------------------------------------===//
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+
// Command line options for MIR Flow Sensitive discriminators.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef LLVM_CODEGEN_MIRFSDISCRIMINATOR_OPTIONS_H
14+
#define LLVM_CODEGEN_MIRFSDISCRIMINATOR_OPTIONS_H
15+
16+
#include "llvm/Support/CommandLine.h"
17+
18+
namespace llvm {
19+
extern cl::opt<bool> ImprovedFSDiscriminator;
20+
} // namespace llvm
21+
22+
#endif // LLVM_CODEGEN_MIRFSDISCRIMINATOR_OPTIONS_H

llvm/lib/CodeGen/MIRFSDiscriminator.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "llvm/ADT/DenseMap.h"
1616
#include "llvm/ADT/DenseSet.h"
1717
#include "llvm/Analysis/BlockFrequencyInfoImpl.h"
18+
#include "llvm/CodeGen/MIRFSDiscriminatorOptions.h"
1819
#include "llvm/CodeGen/Passes.h"
1920
#include "llvm/IR/DebugInfoMetadata.h"
2021
#include "llvm/IR/Function.h"
@@ -35,13 +36,10 @@ using namespace sampleprofutil;
3536

3637
// TODO(xur): Remove this option and related code once we make true as the
3738
// default.
38-
namespace llvm {
39-
cl::opt<bool> ImprovedFSDiscriminator(
39+
cl::opt<bool> llvm::ImprovedFSDiscriminator(
4040
"improved-fs-discriminator", cl::Hidden, cl::init(false),
4141
cl::desc("New FS discriminators encoding (incompatible with the original "
4242
"encoding)"));
43-
} // namespace llvm
44-
4543
char MIRAddFSDiscriminators::ID = 0;
4644

4745
INITIALIZE_PASS(MIRAddFSDiscriminators, DEBUG_TYPE,

llvm/lib/CodeGen/MIRSampleProfile.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "llvm/ADT/DenseMap.h"
1616
#include "llvm/ADT/DenseSet.h"
1717
#include "llvm/Analysis/BlockFrequencyInfoImpl.h"
18+
#include "llvm/CodeGen/MIRFSDiscriminatorOptions.h"
1819
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
1920
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
2021
#include "llvm/CodeGen/MachineDominators.h"
@@ -62,9 +63,6 @@ static cl::opt<bool> ViewBFIAfter("fs-viewbfi-after", cl::Hidden,
6263
cl::init(false),
6364
cl::desc("View BFI after MIR loader"));
6465

65-
namespace llvm {
66-
extern cl::opt<bool> ImprovedFSDiscriminator;
67-
}
6866
char MIRProfileLoaderPass::ID = 0;
6967

7068
INITIALIZE_PASS_BEGIN(MIRProfileLoaderPass, DEBUG_TYPE,

0 commit comments

Comments
 (0)