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

Function GetPhiIndexFromLabel

source/opt/loop_unroller.cpp:338–346  ·  view source on GitHub ↗

Retrieve the index of the OpPhi instruction |phi| which corresponds to the incoming |block| id.

Source from the content-addressed store, hash-verified

336// Retrieve the index of the OpPhi instruction |phi| which corresponds to the
337// incoming |block| id.
338uint32_t GetPhiIndexFromLabel(const BasicBlock* block, const Instruction* phi) {
339 for (uint32_t i = 1; i < phi->NumInOperands(); i += 2) {
340 if (block->id() == phi->GetSingleWordInOperand(i)) {
341 return i;
342 }
343 }
344 assert(false && "Could not find operand in instruction.");
345 return 0;
346}
347
348void LoopUnrollerUtilsImpl::Init(Loop* loop) {
349 loop_condition_block_ = loop->FindConditionBlock();

Callers 2

LinkLastPhisToStartMethod · 0.85

Calls 3

NumInOperandsMethod · 0.80
idMethod · 0.45

Tested by

no test coverage detected