[llvm] ab25757 - Remove a top-level "using namespace" directive from LegalizationArtifactCombiner.h
Pavel Labath via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 18 01:00:43 PDT 2022
Author: Pavel Labath
Date: 2022-03-18T08:58:30+01:00
New Revision: ab25757522341f966bf088912dcc6f9303de3067
URL: https://github.com/llvm/llvm-project/commit/ab25757522341f966bf088912dcc6f9303de3067
DIFF: https://github.com/llvm/llvm-project/commit/ab25757522341f966bf088912dcc6f9303de3067.diff
LOG: Remove a top-level "using namespace" directive from LegalizationArtifactCombiner.h
The directive pollutes the namespace of all files including that header.
Move the directive into the bodies of functions that need it instead.
Added:
Modified:
llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h b/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
index 08d6e1e62ae3d..6802591b6350c 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
@@ -28,7 +28,6 @@
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE "legalizer"
-using namespace llvm::MIPatternMatch;
namespace llvm {
class LegalizationArtifactCombiner {
@@ -57,6 +56,7 @@ class LegalizationArtifactCombiner {
SmallVectorImpl<MachineInstr *> &DeadInsts,
SmallVectorImpl<Register> &UpdatedDefs,
GISelObserverWrapper &Observer) {
+ using namespace llvm::MIPatternMatch;
assert(MI.getOpcode() == TargetOpcode::G_ANYEXT);
Builder.setInstrAndDebugLoc(MI);
@@ -110,6 +110,7 @@ class LegalizationArtifactCombiner {
SmallVectorImpl<MachineInstr *> &DeadInsts,
SmallVectorImpl<Register> &UpdatedDefs,
GISelObserverWrapper &Observer) {
+ using namespace llvm::MIPatternMatch;
assert(MI.getOpcode() == TargetOpcode::G_ZEXT);
Builder.setInstrAndDebugLoc(MI);
@@ -171,6 +172,7 @@ class LegalizationArtifactCombiner {
bool tryCombineSExt(MachineInstr &MI,
SmallVectorImpl<MachineInstr *> &DeadInsts,
SmallVectorImpl<Register> &UpdatedDefs) {
+ using namespace llvm::MIPatternMatch;
assert(MI.getOpcode() == TargetOpcode::G_SEXT);
Builder.setInstrAndDebugLoc(MI);
@@ -228,6 +230,7 @@ class LegalizationArtifactCombiner {
SmallVectorImpl<MachineInstr *> &DeadInsts,
SmallVectorImpl<Register> &UpdatedDefs,
GISelObserverWrapper &Observer) {
+ using namespace llvm::MIPatternMatch;
assert(MI.getOpcode() == TargetOpcode::G_TRUNC);
Builder.setInstr(MI);
@@ -1282,6 +1285,8 @@ class LegalizationArtifactCombiner {
/// Looks through copy instructions and returns the actual
/// source register.
Register lookThroughCopyInstrs(Register Reg) {
+ using namespace llvm::MIPatternMatch;
+
Register TmpReg;
while (mi_match(Reg, MRI, m_Copy(m_Reg(TmpReg)))) {
if (MRI.getType(TmpReg).isValid())
More information about the llvm-commits
mailing list