[llvm] [DA] disambiguate evolution of base addresses (PR #116628)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 12 13:48:43 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 5048808859eece3aaa680aaecb4a89dfabe9627b 555628f263782eea7bab7095c283939ec2377291 --extensions cpp,h -- llvm/include/llvm/Analysis/AliasAnalysis.h llvm/include/llvm/Analysis/DependenceAnalysis.h llvm/lib/Analysis/DependenceAnalysis.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/Analysis/DependenceAnalysis.h b/llvm/include/llvm/Analysis/DependenceAnalysis.h
index 9f9b28e1e3..8b4e10b90a 100644
--- a/llvm/include/llvm/Analysis/DependenceAnalysis.h
+++ b/llvm/include/llvm/Analysis/DependenceAnalysis.h
@@ -46,173 +46,173 @@
#include "llvm/Pass.h"
namespace llvm {
- template <typename T> class ArrayRef;
- class Loop;
- class LoopInfo;
- class ScalarEvolution;
- class SCEV;
- class SCEVConstant;
- class raw_ostream;
-
- /// Dependence - This class represents a dependence between two memory
- /// memory references in a function. It contains minimal information and
- /// is used in the very common situation where the compiler is unable to
- /// determine anything beyond the existence of a dependence; that is, it
- /// represents a confused dependence (see also FullDependence). In most
- /// cases (for output, flow, and anti dependences), the dependence implies
- /// an ordering, where the source must precede the destination; in contrast,
- /// input dependences are unordered.
- ///
- /// When a dependence graph is built, each Dependence will be a member of
- /// the set of predecessor edges for its destination instruction and a set
- /// if successor edges for its source instruction. These sets are represented
- /// as singly-linked lists, with the "next" fields stored in the dependence
- /// itelf.
- class Dependence {
- protected:
- Dependence(Dependence &&) = default;
- Dependence &operator=(Dependence &&) = default;
-
- public:
- Dependence(Instruction *Source, Instruction *Destination)
- : Src(Source), Dst(Destination) {}
- virtual ~Dependence() = default;
-
- /// Dependence::DVEntry - Each level in the distance/direction vector
- /// has a direction (or perhaps a union of several directions), and
- /// perhaps a distance.
- struct DVEntry {
- enum : unsigned char {
- NONE = 0,
- LT = 1,
- EQ = 2,
- LE = 3,
- GT = 4,
- NE = 5,
- GE = 6,
- ALL = 7
- };
- unsigned char Direction : 3; // Init to ALL, then refine.
- bool Scalar : 1; // Init to true.
- bool PeelFirst : 1; // Peeling the first iteration will break dependence.
- bool PeelLast : 1; // Peeling the last iteration will break the dependence.
- bool Splitable : 1; // Splitting the loop will break dependence.
- const SCEV *Distance = nullptr; // NULL implies no distance available.
- DVEntry()
- : Direction(ALL), Scalar(true), PeelFirst(false), PeelLast(false),
- Splitable(false) {}
+template <typename T> class ArrayRef;
+class Loop;
+class LoopInfo;
+class ScalarEvolution;
+class SCEV;
+class SCEVConstant;
+class raw_ostream;
+
+/// Dependence - This class represents a dependence between two memory
+/// memory references in a function. It contains minimal information and
+/// is used in the very common situation where the compiler is unable to
+/// determine anything beyond the existence of a dependence; that is, it
+/// represents a confused dependence (see also FullDependence). In most
+/// cases (for output, flow, and anti dependences), the dependence implies
+/// an ordering, where the source must precede the destination; in contrast,
+/// input dependences are unordered.
+///
+/// When a dependence graph is built, each Dependence will be a member of
+/// the set of predecessor edges for its destination instruction and a set
+/// if successor edges for its source instruction. These sets are represented
+/// as singly-linked lists, with the "next" fields stored in the dependence
+/// itelf.
+class Dependence {
+protected:
+ Dependence(Dependence &&) = default;
+ Dependence &operator=(Dependence &&) = default;
+
+public:
+ Dependence(Instruction *Source, Instruction *Destination)
+ : Src(Source), Dst(Destination) {}
+ virtual ~Dependence() = default;
+
+ /// Dependence::DVEntry - Each level in the distance/direction vector
+ /// has a direction (or perhaps a union of several directions), and
+ /// perhaps a distance.
+ struct DVEntry {
+ enum : unsigned char {
+ NONE = 0,
+ LT = 1,
+ EQ = 2,
+ LE = 3,
+ GT = 4,
+ NE = 5,
+ GE = 6,
+ ALL = 7
};
+ unsigned char Direction : 3; // Init to ALL, then refine.
+ bool Scalar : 1; // Init to true.
+ bool PeelFirst : 1; // Peeling the first iteration will break dependence.
+ bool PeelLast : 1; // Peeling the last iteration will break the dependence.
+ bool Splitable : 1; // Splitting the loop will break dependence.
+ const SCEV *Distance = nullptr; // NULL implies no distance available.
+ DVEntry()
+ : Direction(ALL), Scalar(true), PeelFirst(false), PeelLast(false),
+ Splitable(false) {}
+ };
- /// getSrc - Returns the source instruction for this dependence.
- ///
- Instruction *getSrc() const { return Src; }
+ /// getSrc - Returns the source instruction for this dependence.
+ ///
+ Instruction *getSrc() const { return Src; }
- /// getDst - Returns the destination instruction for this dependence.
- ///
- Instruction *getDst() const { return Dst; }
+ /// getDst - Returns the destination instruction for this dependence.
+ ///
+ Instruction *getDst() const { return Dst; }
- /// isInput - Returns true if this is an input dependence.
- ///
- bool isInput() const;
+ /// isInput - Returns true if this is an input dependence.
+ ///
+ bool isInput() const;
- /// isOutput - Returns true if this is an output dependence.
- ///
- bool isOutput() const;
+ /// isOutput - Returns true if this is an output dependence.
+ ///
+ bool isOutput() const;
- /// isFlow - Returns true if this is a flow (aka true) dependence.
- ///
- bool isFlow() const;
+ /// isFlow - Returns true if this is a flow (aka true) dependence.
+ ///
+ bool isFlow() const;
- /// isAnti - Returns true if this is an anti dependence.
- ///
- bool isAnti() const;
+ /// isAnti - Returns true if this is an anti dependence.
+ ///
+ bool isAnti() const;
- /// isOrdered - Returns true if dependence is Output, Flow, or Anti
- ///
- bool isOrdered() const { return isOutput() || isFlow() || isAnti(); }
+ /// isOrdered - Returns true if dependence is Output, Flow, or Anti
+ ///
+ bool isOrdered() const { return isOutput() || isFlow() || isAnti(); }
- /// isUnordered - Returns true if dependence is Input
- ///
- bool isUnordered() const { return isInput(); }
+ /// isUnordered - Returns true if dependence is Input
+ ///
+ bool isUnordered() const { return isInput(); }
- /// isLoopIndependent - Returns true if this is a loop-independent
- /// dependence.
- virtual bool isLoopIndependent() const { return true; }
+ /// isLoopIndependent - Returns true if this is a loop-independent
+ /// dependence.
+ virtual bool isLoopIndependent() const { return true; }
- /// isConfused - Returns true if this dependence is confused
- /// (the compiler understands nothing and makes worst-case
- /// assumptions).
- virtual bool isConfused() const { return true; }
+ /// isConfused - Returns true if this dependence is confused
+ /// (the compiler understands nothing and makes worst-case
+ /// assumptions).
+ virtual bool isConfused() const { return true; }
- /// isConsistent - Returns true if this dependence is consistent
- /// (occurs every time the source and destination are executed).
- virtual bool isConsistent() const { return false; }
+ /// isConsistent - Returns true if this dependence is consistent
+ /// (occurs every time the source and destination are executed).
+ virtual bool isConsistent() const { return false; }
- /// getLevels - Returns the number of common loops surrounding the
- /// source and destination of the dependence.
- virtual unsigned getLevels() const { return 0; }
+ /// getLevels - Returns the number of common loops surrounding the
+ /// source and destination of the dependence.
+ virtual unsigned getLevels() const { return 0; }
- /// getDirection - Returns the direction associated with a particular
- /// level.
- virtual unsigned getDirection(unsigned Level) const { return DVEntry::ALL; }
+ /// getDirection - Returns the direction associated with a particular
+ /// level.
+ virtual unsigned getDirection(unsigned Level) const { return DVEntry::ALL; }
- /// getDistance - Returns the distance (or NULL) associated with a
- /// particular level.
- virtual const SCEV *getDistance(unsigned Level) const { return nullptr; }
+ /// getDistance - Returns the distance (or NULL) associated with a
+ /// particular level.
+ virtual const SCEV *getDistance(unsigned Level) const { return nullptr; }
- /// Check if the direction vector is negative. A negative direction
- /// vector means Src and Dst are reversed in the actual program.
- virtual bool isDirectionNegative() const { return false; }
+ /// Check if the direction vector is negative. A negative direction
+ /// vector means Src and Dst are reversed in the actual program.
+ virtual bool isDirectionNegative() const { return false; }
- /// If the direction vector is negative, normalize the direction
- /// vector to make it non-negative. Normalization is done by reversing
- /// Src and Dst, plus reversing the dependence directions and distances
- /// in the vector.
- virtual bool normalize(ScalarEvolution *SE) { return false; }
+ /// If the direction vector is negative, normalize the direction
+ /// vector to make it non-negative. Normalization is done by reversing
+ /// Src and Dst, plus reversing the dependence directions and distances
+ /// in the vector.
+ virtual bool normalize(ScalarEvolution *SE) { return false; }
- /// isPeelFirst - Returns true if peeling the first iteration from
- /// this loop will break this dependence.
- virtual bool isPeelFirst(unsigned Level) const { return false; }
+ /// isPeelFirst - Returns true if peeling the first iteration from
+ /// this loop will break this dependence.
+ virtual bool isPeelFirst(unsigned Level) const { return false; }
- /// isPeelLast - Returns true if peeling the last iteration from
- /// this loop will break this dependence.
- virtual bool isPeelLast(unsigned Level) const { return false; }
+ /// isPeelLast - Returns true if peeling the last iteration from
+ /// this loop will break this dependence.
+ virtual bool isPeelLast(unsigned Level) const { return false; }
- /// isSplitable - Returns true if splitting this loop will break
- /// the dependence.
- virtual bool isSplitable(unsigned Level) const { return false; }
+ /// isSplitable - Returns true if splitting this loop will break
+ /// the dependence.
+ virtual bool isSplitable(unsigned Level) const { return false; }
- /// isScalar - Returns true if a particular level is scalar; that is,
- /// if no subscript in the source or destination mention the induction
- /// variable associated with the loop at this level.
- virtual bool isScalar(unsigned Level) const;
+ /// isScalar - Returns true if a particular level is scalar; that is,
+ /// if no subscript in the source or destination mention the induction
+ /// variable associated with the loop at this level.
+ virtual bool isScalar(unsigned Level) const;
- /// getNextPredecessor - Returns the value of the NextPredecessor
- /// field.
- const Dependence *getNextPredecessor() const { return NextPredecessor; }
+ /// getNextPredecessor - Returns the value of the NextPredecessor
+ /// field.
+ const Dependence *getNextPredecessor() const { return NextPredecessor; }
- /// getNextSuccessor - Returns the value of the NextSuccessor
- /// field.
- const Dependence *getNextSuccessor() const { return NextSuccessor; }
+ /// getNextSuccessor - Returns the value of the NextSuccessor
+ /// field.
+ const Dependence *getNextSuccessor() const { return NextSuccessor; }
- /// setNextPredecessor - Sets the value of the NextPredecessor
- /// field.
- void setNextPredecessor(const Dependence *pred) { NextPredecessor = pred; }
+ /// setNextPredecessor - Sets the value of the NextPredecessor
+ /// field.
+ void setNextPredecessor(const Dependence *pred) { NextPredecessor = pred; }
- /// setNextSuccessor - Sets the value of the NextSuccessor
- /// field.
- void setNextSuccessor(const Dependence *succ) { NextSuccessor = succ; }
+ /// setNextSuccessor - Sets the value of the NextSuccessor
+ /// field.
+ void setNextSuccessor(const Dependence *succ) { NextSuccessor = succ; }
- /// dump - For debugging purposes, dumps a dependence to OS.
- ///
- void dump(raw_ostream &OS) const;
+ /// dump - For debugging purposes, dumps a dependence to OS.
+ ///
+ void dump(raw_ostream &OS) const;
- protected:
- Instruction *Src, *Dst;
+protected:
+ Instruction *Src, *Dst;
- private:
- const Dependence *NextPredecessor = nullptr, *NextSuccessor = nullptr;
- friend class DependenceInfo;
+private:
+ const Dependence *NextPredecessor = nullptr, *NextSuccessor = nullptr;
+ friend class DependenceInfo;
};
/// FullDependence - This class represents a dependence between two memory
@@ -1023,6 +1023,6 @@ namespace llvm {
/// DependenceAnalysis wrapper pass.
FunctionPass *createDependenceAnalysisWrapperPass();
-} // namespace llvm
+ } // namespace llvm
#endif
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 03f3fafb85..3657476e26 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -743,7 +743,6 @@ static AliasResult underlyingObjectsAlias(BatchAAResults &BAA,
return AliasResult::NoAlias;
}
-
// Returns true if the load or store can be analyzed. Atomic and volatile
// operations have properties which this analysis does not understand.
static
``````````
</details>
https://github.com/llvm/llvm-project/pull/116628
More information about the llvm-commits
mailing list