Skip to content

Commit

Permalink
[SimplifyQuery] Avoid PatternMatch.h include (NFC)
Browse files Browse the repository at this point in the history
Move the one method that uses it out of line. This is primarily to
reduce the number of files to rebuild when changing PatternMatch.h.
  • Loading branch information
nikic committed Apr 23, 2024
1 parent af8445e commit f8a19a8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/InstructionSimplify.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H

#include "llvm/Analysis/SimplifyQuery.h"
#include "llvm/IR/FPEnv.h"

namespace llvm {

Expand All @@ -44,6 +45,7 @@ class DataLayout;
class DominatorTree;
class Function;
class Instruction;
class LoadInst;
struct LoopStandardAnalysisResults;
class Pass;
template <class T, unsigned n> class SmallSetVector;
Expand Down
10 changes: 2 additions & 8 deletions llvm/include/llvm/Analysis/SimplifyQuery.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef LLVM_ANALYSIS_SIMPLIFYQUERY_H
#define LLVM_ANALYSIS_SIMPLIFYQUERY_H

#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Operator.h"

namespace llvm {

Expand Down Expand Up @@ -106,13 +106,7 @@ struct SimplifyQuery {

/// If CanUseUndef is true, returns whether \p V is undef.
/// Otherwise always return false.
bool isUndefValue(Value *V) const {
if (!CanUseUndef)
return false;

using namespace PatternMatch;
return match(V, m_Undef());
}
bool isUndefValue(Value *V) const;

SimplifyQuery getWithoutDomCondCache() const {
SimplifyQuery Copy(*this);
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/ValueTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/FMF.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Intrinsics.h"
#include <cassert>
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Analysis/BasicAliasAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
Expand Down
8 changes: 8 additions & 0 deletions llvm/lib/Analysis/InstructionSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7238,6 +7238,14 @@ const SimplifyQuery getBestSimplifyQuery(AnalysisManager<T, TArgs...> &AM,
}
template const SimplifyQuery getBestSimplifyQuery(AnalysisManager<Function> &,
Function &);

bool SimplifyQuery::isUndefValue(Value *V) const {
if (!CanUseUndef)
return false;

return match(V, m_Undef());
}

} // namespace llvm

void InstSimplifyFolder::anchor() {}

0 comments on commit f8a19a8

Please sign in to comment.