MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / CalculateConstantTerm

Function CalculateConstantTerm

source/opt/loop_dependence.cpp:135–148  ·  view source on GitHub ↗

Fold all SEConstantNode that appear in |recurrences| and |constants| into a single integer value.

Source from the content-addressed store, hash-verified

133// Fold all SEConstantNode that appear in |recurrences| and |constants| into a
134// single integer value.
135int64_t CalculateConstantTerm(const std::vector<SERecurrentNode*>& recurrences,
136 const std::vector<SEConstantNode*>& constants) {
137 int64_t constant_term = 0;
138 for (auto recurrence : recurrences) {
139 constant_term +=
140 recurrence->GetOffset()->AsSEConstantNode()->FoldToSingleValue();
141 }
142
143 for (auto constant : constants) {
144 constant_term += constant->FoldToSingleValue();
145 }
146
147 return constant_term;
148}
149
150int64_t CalculateGCDFromCoefficients(
151 const std::vector<SERecurrentNode*>& recurrences, int64_t running_gcd) {

Callers 1

GCDMIVTestMethod · 0.85

Calls 3

FoldToSingleValueMethod · 0.80
AsSEConstantNodeMethod · 0.80
GetOffsetMethod · 0.80

Tested by

no test coverage detected