LLVM: lib/Analysis/ScalarEvolutionNormalization.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

18using namespace llvm;

19

20

21

23

25

26

29

30namespace {

31struct NormalizeDenormalizeRewriter

34

35

36

38

42 Pred(Pred) {}

44};

45}

46

48NormalizeDenormalizeRewriter::visitAddRecExpr(const SCEVAddRecExpr *AR) {

50

52 [&](const SCEV *Op) { return visit(Op); });

53

54 if (!Pred(AR))

56

57

58

59

60

61

63

64

65

66 for (int i = 0, e = Operands.size() - 1; i < e; i++)

68 } else {

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90 for (int i = Operands.size() - 2; i >= 0; i--)

92 }

93

95}

96

100 bool CheckInvertible) {

101 if (Loops.empty())

102 return S;

105 };

106 const SCEV *Normalized =

107 NormalizeDenormalizeRewriter(Normalize, Pred, SE).visit(S);

109

110 if (CheckInvertible && Denormalized != S)

111 return nullptr;

112 return Normalized;

113}

114

117 return NormalizeDenormalizeRewriter(Normalize, Pred, SE).visit(S);

118}

119

123 if (Loops.empty())

124 return S;

127 };

128 return NormalizeDenormalizeRewriter(Denormalize, Pred, SE).visit(S);

129}

mir Rename Register Operands

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

TransformKind

TransformKind - Different types of transformations that TransformForPostIncUse can do.

@ Normalize

Normalize - Normalize according to the given loops.

@ Denormalize

Denormalize - Perform the inverse transform on the expression with the given loop set.

This class represents an Operation in the Expression.

This node represents a polynomial recurrence on the trip count of the specified loop.

const Loop * getLoop() const

ArrayRef< const SCEV * > operands() const

This visitor recursively visits a SCEV expression and re-writes it.

const SCEV * visitAddRecExpr(const SCEVAddRecExpr *Expr)

This class represents an analyzed expression in the program.

The main scalar evolution driver.

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

An efficient, type-erasing, non-owning reference to a callable.

This is an optimization pass for GlobalISel generic memory operations.

OutputIt transform(R &&Range, OutputIt d_first, UnaryFunction F)

Wrapper function around std::transform to apply a function to a range and store the result elsewhere.

const SCEV * denormalizeForPostIncUse(const SCEV *S, const PostIncLoopSet &Loops, ScalarEvolution &SE)

Denormalize S to be post-increment for all loops present in Loops.

const SCEV * normalizeForPostIncUse(const SCEV *S, const PostIncLoopSet &Loops, ScalarEvolution &SE, bool CheckInvertible=true)

Normalize S to be post-increment for all loops present in Loops.

const SCEV * normalizeForPostIncUseIf(const SCEV *S, NormalizePredTy Pred, ScalarEvolution &SE)

Normalize S for all add recurrence sub-expressions for which Pred returns true.