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

Method Init

source/opt/loop_unroller.cpp:348–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348void LoopUnrollerUtilsImpl::Init(Loop* loop) {
349 loop_condition_block_ = loop->FindConditionBlock();
350
351 // When we reinit the second loop during PartiallyUnrollResidualFactor we need
352 // to use the cached value from the duplicate step as the dominator tree
353 // basded solution, loop->FindConditionBlock, requires all the nodes to be
354 // connected up with the correct branches. They won't be at this point.
355 if (!loop_condition_block_) {
356 loop_condition_block_ = state_.new_condition_block;
357 }
358 assert(loop_condition_block_);
359
360 loop_induction_variable_ = loop->FindConditionVariable(loop_condition_block_);
361 assert(loop_induction_variable_);
362
363 bool found = loop->FindNumberOfIterations(
364 loop_induction_variable_, &*loop_condition_block_->ctail(),
365 &number_of_loop_iterations_, &loop_step_value_, &loop_init_value_);
366 (void)found; // To silence unused variable warning on release builds.
367 assert(found);
368
369 // Blocks are stored in an unordered set of ids in the loop class, we need to
370 // create the dominator ordered list.
371 ComputeLoopOrderedBlocks(loop);
372}
373
374// This function is used to partially unroll the loop when the factor provided
375// would normally lead to an illegal optimization. Instead of just unrolling the

Callers 2

PartiallyUnrollMethod · 0.80
FullyUnrollMethod · 0.80

Calls 4

FindConditionBlockMethod · 0.80
FindConditionVariableMethod · 0.80
ctailMethod · 0.80

Tested by

no test coverage detected