From dd8eb88b1f695843f37cee43e190033371e01c01 Mon Sep 17 00:00:00 2001
From: akashk4 <akashk4@illinois.edu>
Date: Wed, 8 Jan 2020 08:31:27 -0600
Subject: [PATCH] Fix arguments in DFG2LLVM header -- partially tested

---
 hpvm/include/SupportVISC/DFG2LLVM.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hpvm/include/SupportVISC/DFG2LLVM.h b/hpvm/include/SupportVISC/DFG2LLVM.h
index c3db1a77c1..a2d17801ff 100644
--- a/hpvm/include/SupportVISC/DFG2LLVM.h
+++ b/hpvm/include/SupportVISC/DFG2LLVM.h
@@ -341,6 +341,8 @@ Function *CodeGenTraversal::addArgument(Function* F, Type* Ty, const Twine& name
       ai != ae; ++ai) {
     ArgTypes.push_back(ai->getType());
   }
+  ArgTypes.push_back(new_arg->getType());
+  
   // Adding new arguments to the function argument list, would not change the
   // function type. We need to change the type of this function to reflect the
   // added arguments. So, we create a clone of this function with the correct
@@ -377,8 +379,9 @@ Function *CodeGenTraversal::addIdxDimArgs(Function* F) {
   Function *newF;
   for (int i = 0; i < 6; ++i) {
     newF = addArgument(F, Type::getInt64Ty(F->getContext()), names[i]);
+    ArgTypes.push_back(new_arg->getType());
     F->replaceAllUsesWith(UndefValue::get(F->getType()));
-    F->eraseFromParent();
+   // F->eraseFromParent();
     F = newF;
   }
   errs() << "Function Type after adding args: " << *newF->getFunctionType() << "\n";
-- 
GitLab