Skip to content

Commit

Permalink
Remove a top-level "using namespace" directive from LegalizationArtif…
Browse files Browse the repository at this point in the history
…actCombiner.h

The directive pollutes the namespace of all files including that header.
Move the directive into the bodies of functions that need it instead.
  • Loading branch information
labath committed Mar 18, 2022
1 parent c7fc720 commit ab25757
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -28,7 +28,6 @@
#include "llvm/Support/Debug.h"

#define DEBUG_TYPE "legalizer"
using namespace llvm::MIPatternMatch;

namespace llvm {
class LegalizationArtifactCombiner {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit ab25757

Please sign in to comment.