diff --git a/hpvm/include/SupportVISC/DFGraph.h b/hpvm/include/SupportVISC/DFGraph.h index a5d7252f4050d0cbc3adc36c17e05d9220f2e57a..b74aee83797291d2b75100f10a82b430f72743b6 100644 --- a/hpvm/include/SupportVISC/DFGraph.h +++ b/hpvm/include/SupportVISC/DFGraph.h @@ -315,7 +315,11 @@ public: bool isRoot() const { // It is a root node is it was created from a launch intrinsic - return II->getCalledFunction()->getName().equals("llvm.visc.launch"); + if(II->getCalledFunction()->getName().equals("llvm.visc.launch")) { + assert(Level == 0 && "Root node's level is zero."); + return true; + } + return false; } StructType* getOutputType() const { diff --git a/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp b/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp index 8d5a5cb0e6f41b550be883917a9d377f562f2200..a8cd54914bbaa7d6d0378fb4bf85548fd260e796 100644 --- a/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp +++ b/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp @@ -71,10 +71,17 @@ bool BuildDFG::runOnModule(Module &M) { } DFInternalNode *BuildDFG::getRoot() const { + assert(Root && Root->getLevel() == 0 && "Invalid root node."); return Root; } std::vector<DFInternalNode*> &BuildDFG::getRoots() { + assert((Roots.size() != 0) && "Number of roots cannot be zero."); + + // All roots should have the same level + for(auto *Node : Roots) + assert(Node->getLevel() == 0 && "Invalid root node."); + return Roots; }