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

Method ProcessFunction

source/opt/loop_unswitch_pass.cpp:608–641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608Pass::Status LoopUnswitchPass::ProcessFunction(Function* f) {
609 bool modified = false;
610 std::unordered_set<Loop*> processed_loop;
611
612 LoopDescriptor& loop_descriptor = *context()->GetLoopDescriptor(f);
613
614 bool loop_changed = true;
615 while (loop_changed) {
616 loop_changed = false;
617 for (Loop& loop : make_range(
618 ++TreeDFIterator<Loop>(loop_descriptor.GetPlaceholderRootLoop()),
619 TreeDFIterator<Loop>())) {
620 if (processed_loop.count(&loop)) continue;
621 processed_loop.insert(&loop);
622
623 LoopUnswitch unswitcher(context(), f, &loop, &loop_descriptor);
624 while (unswitcher.CanUnswitchLoop()) {
625 if (!loop.IsLCSSA()) {
626 if (!LoopUtils(context(), &loop).MakeLoopClosedSSA()) {
627 return Status::Failure;
628 }
629 }
630 if (!unswitcher.PerformUnswitch()) {
631 return Status::Failure;
632 }
633 modified = true;
634 loop_changed = true;
635 }
636 if (loop_changed) break;
637 }
638 }
639
640 return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange;
641}
642
643} // namespace opt
644} // namespace spvtools

Callers

nothing calls this directly

Calls 10

make_rangeFunction · 0.85
LoopUtilsClass · 0.85
CanUnswitchLoopMethod · 0.80
IsLCSSAMethod · 0.80
MakeLoopClosedSSAMethod · 0.80
PerformUnswitchMethod · 0.80
GetLoopDescriptorMethod · 0.45
countMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected