Skip to content

Commit 9ebf1e9

Browse files
authored
[NFC][InstCombine] Fix namespace usage in InstCombine (#161902)
1 parent a368fb5 commit 9ebf1e9

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

llvm/lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515

1616
using namespace llvm;
1717

18-
namespace {
1918
/// Return true if and only if the given instruction does not modify the memory
2019
/// location referenced. Note that an idemptent atomicrmw may still have
2120
/// ordering effects on nearby instructions, or be volatile.
2221
/// TODO: Common w/ the version in AtomicExpandPass, and change the term used.
2322
/// Idemptotent is confusing in this context.
24-
bool isIdempotentRMW(AtomicRMWInst& RMWI) {
23+
static bool isIdempotentRMW(AtomicRMWInst &RMWI) {
2524
if (auto CF = dyn_cast<ConstantFP>(RMWI.getValOperand()))
2625
switch(RMWI.getOperation()) {
2726
case AtomicRMWInst::FAdd: // -0.0
@@ -59,7 +58,7 @@ bool isIdempotentRMW(AtomicRMWInst& RMWI) {
5958

6059
/// Return true if the given instruction always produces a value in memory
6160
/// equivalent to its value operand.
62-
bool isSaturating(AtomicRMWInst& RMWI) {
61+
static bool isSaturating(AtomicRMWInst &RMWI) {
6362
if (auto CF = dyn_cast<ConstantFP>(RMWI.getValOperand()))
6463
switch (RMWI.getOperation()) {
6564
case AtomicRMWInst::FMax:
@@ -98,7 +97,6 @@ bool isSaturating(AtomicRMWInst& RMWI) {
9897
return C->isMaxValue(false);
9998
};
10099
}
101-
} // namespace
102100

103101
Instruction *InstCombinerImpl::visitAtomicRMWInst(AtomicRMWInst &RMWI) {
104102

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ STATISTIC(NumReassoc , "Number of reassociations");
132132
DEBUG_COUNTER(VisitCounter, "instcombine-visit",
133133
"Controls which instructions are visited");
134134

135-
namespace llvm {
136-
137135
static cl::opt<bool> EnableCodeSinking("instcombine-code-sinking",
138136
cl::desc("Enable code sinking"),
139137
cl::init(true));
@@ -146,7 +144,9 @@ static cl::opt<unsigned>
146144
MaxArraySize("instcombine-maxarray-size", cl::init(1024),
147145
cl::desc("Maximum array size considered when doing a combine"));
148146

147+
namespace llvm {
149148
extern cl::opt<bool> ProfcheckDisableMetadataFixes;
149+
} // end namespace llvm
150150

151151
// FIXME: Remove this flag when it is no longer necessary to convert
152152
// llvm.dbg.declare to avoid inaccurate debug info. Setting this to false
@@ -158,8 +158,6 @@ extern cl::opt<bool> ProfcheckDisableMetadataFixes;
158158
static cl::opt<unsigned> ShouldLowerDbgDeclare("instcombine-lower-dbg-declare",
159159
cl::Hidden, cl::init(true));
160160

161-
} // end namespace llvm
162-
163161
std::optional<Instruction *>
164162
InstCombiner::targetInstCombineIntrinsic(IntrinsicInst &II) {
165163
// Handle target specific intrinsics

0 commit comments

Comments
 (0)