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

Method IsSupportedLoop

source/opt/loop_dependence_helpers.cpp:452–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452bool LoopDependenceAnalysis::IsSupportedLoop(const Loop* loop) {
453 std::vector<Instruction*> inductions{};
454 loop->GetInductionVariables(inductions);
455 if (inductions.size() != 1) {
456 return false;
457 }
458 Instruction* induction = inductions[0];
459 SENode* induction_node = scalar_evolution_.SimplifyExpression(
460 scalar_evolution_.AnalyzeInstruction(induction));
461 if (!induction_node->AsSERecurrentNode()) {
462 return false;
463 }
464 SENode* induction_step =
465 induction_node->AsSERecurrentNode()->GetCoefficient();
466 if (!induction_step->AsSEConstantNode()) {
467 return false;
468 }
469 if (!(induction_step->AsSEConstantNode()->FoldToSingleValue() == 1 ||
470 induction_step->AsSEConstantNode()->FoldToSingleValue() == -1)) {
471 return false;
472 }
473 return true;
474}
475
476void LoopDependenceAnalysis::PrintDebug(std::string debug_msg) {
477 if (debug_stream_) {

Callers 1

TESTFunction · 0.80

Calls 8

GetInductionVariablesMethod · 0.80
SimplifyExpressionMethod · 0.80
AnalyzeInstructionMethod · 0.80
AsSERecurrentNodeMethod · 0.80
GetCoefficientMethod · 0.80
AsSEConstantNodeMethod · 0.80
FoldToSingleValueMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected