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

Function IsInCorrectFormForGCDTest

source/opt/loop_dependence.cpp:71–84  ·  view source on GitHub ↗

Check if node is affine, ie in the form: a0*i0 + a1*i1 + ... an*in + c and contains only the following types of nodes: SERecurrentNode, SEAddNode and SEConstantNode

Source from the content-addressed store, hash-verified

69// and contains only the following types of nodes: SERecurrentNode, SEAddNode
70// and SEConstantNode
71bool IsInCorrectFormForGCDTest(SENode* node) {
72 bool children_ok = true;
73
74 if (auto add_node = node->AsSEAddNode()) {
75 for (auto child : add_node->GetChildren()) {
76 children_ok &= IsInCorrectFormForGCDTest(child);
77 }
78 }
79
80 bool this_ok = node->AsSERecurrentNode() || node->AsSEAddNode() ||
81 node->AsSEConstantNode();
82
83 return children_ok && this_ok;
84}
85
86// If |node| is an SERecurrentNode then returns |node| or if |node| is an
87// SEAddNode returns a vector of SERecurrentNode that are its children.

Callers 1

GCDMIVTestMethod · 0.85

Calls 3

AsSEAddNodeMethod · 0.80
AsSERecurrentNodeMethod · 0.80
AsSEConstantNodeMethod · 0.80

Tested by

no test coverage detected