LLVM 17.0.0git
ScalarEvolutionAliasAnalysis.h
Go to the documentation of this file.
1//===- ScalarEvolutionAliasAnalysis.h - SCEV-based AA -----------*- C++ -*-===//
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/// \file
9/// This is the interface for a SCEV-based alias analysis.
10///
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_ANALYSIS_SCALAREVOLUTIONALIASANALYSIS_H
14#define LLVM_ANALYSIS_SCALAREVOLUTIONALIASANALYSIS_H
15
17#include "llvm/Pass.h"
18
19namespace llvm {
20
21class Function;
22class ScalarEvolution;
23class SCEV;
24
25/// A simple alias analysis implementation that uses ScalarEvolution to answer
26/// queries.
27class SCEVAAResult : public AAResultBase {
29
30public:
31 explicit SCEVAAResult(ScalarEvolution &SE) : SE(SE) {}
33
34 AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
35 AAQueryInfo &AAQI, const Instruction *CtxI);
36
37 bool invalidate(Function &F, const PreservedAnalyses &PA,
39
40private:
41 Value *GetBaseValue(const SCEV *S);
42};
43
44/// Analysis pass providing a never-invalidated alias analysis result.
45class SCEVAA : public AnalysisInfoMixin<SCEVAA> {
47 static AnalysisKey Key;
48
49public:
51
53};
54
55/// Legacy wrapper pass to provide the SCEVAAResult object.
57 std::unique_ptr<SCEVAAResult> Result;
58
59public:
60 static char ID;
61
63
64 SCEVAAResult &getResult() { return *Result; }
65 const SCEVAAResult &getResult() const { return *Result; }
66
67 bool runOnFunction(Function &F) override;
68 void getAnalysisUsage(AnalysisUsage &AU) const override;
69};
70
71/// Creates an instance of \c SCEVAAWrapperPass.
72FunctionPass *createSCEVAAWrapperPass();
73
74}
75
76#endif
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
#define F(x, y, z)
Definition: MD5.cpp:55
This class stores info we want to provide to or retain within an alias query.
A base class to help implement the function alias analysis results concept.
The possible results of an alias query.
Definition: AliasAnalysis.h:83
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:661
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:620
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:308
Representation for a specific memory location.
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
A simple alias analysis implementation that uses ScalarEvolution to answer queries.
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
SCEVAAResult(ScalarEvolution &SE)
SCEVAAResult(SCEVAAResult &&Arg)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI)
Legacy wrapper pass to provide the SCEVAAResult object.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
const SCEVAAResult & getResult() const
Analysis pass providing a never-invalidated alias analysis result.
SCEVAAResult run(Function &F, FunctionAnalysisManager &AM)
This class represents an analyzed expression in the program.
The main scalar evolution driver.
LLVM Value Representation.
Definition: Value.h:74
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
FunctionPass * createSCEVAAWrapperPass()
Creates an instance of SCEVAAWrapperPass.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1862
Definition: BitVector.h:851
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:394
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:69