From d3670c76e816430694fc85f734a9f16f5f0c9e98 Mon Sep 17 00:00:00 2001
From: Vir Narula <virsvirus@gmail.com>
Date: Mon, 6 Jul 2020 14:17:02 -0500
Subject: [PATCH] Add update debug statements

---
 hpvm/include/SupportHPVM/DFG2LLVM.h  | 1 +
 hpvm/include/SupportHPVM/HPVMUtils.h | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/hpvm/include/SupportHPVM/DFG2LLVM.h b/hpvm/include/SupportHPVM/DFG2LLVM.h
index fb1e35033e..c1ade92e9a 100644
--- a/hpvm/include/SupportHPVM/DFG2LLVM.h
+++ b/hpvm/include/SupportHPVM/DFG2LLVM.h
@@ -291,6 +291,7 @@ Function *CodeGenTraversal::addArgument(Function *F, Type *Ty,
 // Return new function with additional index and limit arguments.
 // The original function is removed from the module and erased.
 Function *CodeGenTraversal::addIdxDimArgs(Function *F) {
+  DEBUG(errs() << "Adding dimension and limit arguments to Function: " << F->getName());
   DEBUG(errs() << "Function Type: " << *F->getFunctionType() << "\n");
   // Add Index and Dim arguments
   std::string names[] = {"idx_x", "idx_y", "idx_z", "dim_x", "dim_y", "dim_z"};
diff --git a/hpvm/include/SupportHPVM/HPVMUtils.h b/hpvm/include/SupportHPVM/HPVMUtils.h
index ee18a81273..2a5116ddb1 100644
--- a/hpvm/include/SupportHPVM/HPVMUtils.h
+++ b/hpvm/include/SupportHPVM/HPVMUtils.h
@@ -175,14 +175,15 @@ void replaceNodeFunctionInIR(Module &M, Function *F, Function *G) {
           continue;
 
         // Otherwise, replace F with G
-        DEBUG(errs() << *G->getType() << "\n");
-        DEBUG(errs() << *CI->getArgOperand(1)->getType() << "\n");
+        DEBUG(errs() << "Fixing use: " << *CI << "\n");
+        DEBUG(errs() << "in function: " << Func.getName() << "\n");
         CI->setArgOperand(1, G);
+        DEBUG(errs() << "Fixed use: " << *CI << "\n");
       }
     }
 
     for (auto I : toBeErased) {
-      DEBUG(errs() << "\tErasing " << *I << "\n");
+      DEBUG(errs() << "\tErasing Instruction: " << *I << "\n");
       I->eraseFromParent();
     }
   }
-- 
GitLab