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

Method Process

source/opt/loop_unroller.cpp:1180–1215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1178 */
1179
1180Pass::Status LoopUnroller::Process() {
1181 bool changed = false;
1182 for (Function& f : *context()->module()) {
1183 if (f.IsDeclaration()) {
1184 continue;
1185 }
1186
1187 LoopDescriptor* LD = context()->GetLoopDescriptor(&f);
1188 for (Loop& loop : *LD) {
1189 LoopUtils loop_utils{context(), &loop};
1190 if (!loop.HasUnrollLoopControl() || !loop_utils.CanPerformUnroll()) {
1191 continue;
1192 }
1193
1194 if (fully_unroll_) {
1195 if (!loop_utils.FullyUnroll()) {
1196 return Status::Failure;
1197 }
1198 changed = true;
1199 } else {
1200 if (!loop_utils.PartiallyUnroll(unroll_factor_)) {
1201 return Status::Failure;
1202 }
1203 changed = true;
1204 }
1205 }
1206 LD->PostModificationCleanup();
1207 }
1208
1209 if (changed) {
1210 context()->InvalidateAnalysesExceptFor(
1211 IRContext::Analysis::kAnalysisLoopAnalysis);
1212 }
1213
1214 return changed ? Status::SuccessWithChange : Status::SuccessWithoutChange;
1215}
1216
1217} // namespace opt
1218} // namespace spvtools

Callers

nothing calls this directly

Calls 9

IsDeclarationMethod · 0.80
HasUnrollLoopControlMethod · 0.80
CanPerformUnrollMethod · 0.80
FullyUnrollMethod · 0.80
PartiallyUnrollMethod · 0.80
moduleMethod · 0.45
GetLoopDescriptorMethod · 0.45

Tested by

no test coverage detected