From f37a2bb5449efe3a820dac6baa886ca9d5cb63f2 Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Tue, 30 Mar 2021 20:46:51 -0500
Subject: [PATCH] Removed some warnings

---
 hpvm/include/SupportHPVM/HPVMUtils.h          |  1 +
 hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp     | 12 ----------
 .../Transforms/DFG2LLVM_CPU/DFG2LLVM_CPU.cpp  | 24 -------------------
 .../DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp         |  3 ---
 .../soc_simulator/promise_timing_model.cpp    |  4 ++--
 5 files changed, 3 insertions(+), 41 deletions(-)

diff --git a/hpvm/include/SupportHPVM/HPVMUtils.h b/hpvm/include/SupportHPVM/HPVMUtils.h
index 9a91494a41..781306956d 100644
--- a/hpvm/include/SupportHPVM/HPVMUtils.h
+++ b/hpvm/include/SupportHPVM/HPVMUtils.h
@@ -404,6 +404,7 @@ bool tagIncludesTarget(hpvm::Target Tag, hpvm::Target T) {
       return false;
   default:
     assert(false && "Unknown Target\n");
+    return false;  // What kind of compiler doesn't know this is unreachable?!
   }
 }
 
diff --git a/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp b/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
index 7ebdc39c28..e7293a0640 100644
--- a/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
+++ b/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
@@ -58,19 +58,7 @@ bool BuildDFG::runOnModule(Module &M) {
         Roots.push_back(Root);
         BuildGraph(Root, F);
 
-        for (DFGraph::children_iterator i = Root->getChildGraph()->begin(),
-                                        e = Root->getChildGraph()->end();
-             i != e; i++) {
-          DFNode *N = *i;
-          // DEBUG(errs() << "\t" << N->getFuncPointer()->getName() << "\n");
-        }
         Root->getChildGraph()->sortChildren();
-        for (DFGraph::children_iterator i = Root->getChildGraph()->begin(),
-                                        e = Root->getChildGraph()->end();
-             i != e; i++) {
-          DFNode *N = *i;
-          // DEBUG(errs() << "\t" << N->getFuncPointer()->getName() << "\n");
-        }
         viewDFGraph(Root->getChildGraph());
       }
     }
diff --git a/hpvm/lib/Transforms/DFG2LLVM_CPU/DFG2LLVM_CPU.cpp b/hpvm/lib/Transforms/DFG2LLVM_CPU/DFG2LLVM_CPU.cpp
index a44b79b3fe..d5904bd83c 100644
--- a/hpvm/lib/Transforms/DFG2LLVM_CPU/DFG2LLVM_CPU.cpp
+++ b/hpvm/lib/Transforms/DFG2LLVM_CPU/DFG2LLVM_CPU.cpp
@@ -283,30 +283,6 @@ void CGT_CPU::addWhileLoop(Instruction *CondBlockStart, Instruction *BodyStart,
   ReplaceInstWithInst(WhileBody->getTerminator(), UnconditionalBranch);
 }
 
-Instruction *CGT_CPU::addWhileLoopCounter(BasicBlock *Entry, BasicBlock *Cond,
-                                          BasicBlock *Body) {
-  Module *M = Entry->getParent()->getParent();
-  Type *Int64Ty = Type::getInt64Ty(M->getContext());
-
-  // Insert a PHI instruction at the beginning of the condition block
-  Instruction *IB = Cond->getFirstNonPHI();
-  PHINode *CounterPhi = PHINode::Create(Int64Ty, 2, "cnt", IB);
-
-  ConstantInt *IConst =
-      ConstantInt::get(Type::getInt64Ty(M->getContext()), 1, true);
-  Instruction *CounterIncr =
-      BinaryOperator::CreateNSW(Instruction::BinaryOps::Add, CounterPhi, IConst,
-                                "cnt_incr", Body->getTerminator());
-
-  // Set incoming values for Phi node
-  IConst = ConstantInt::get(Type::getInt64Ty(M->getContext()), 0, true);
-  CounterPhi->addIncoming(IConst, Entry);
-  CounterPhi->addIncoming(CounterIncr, Body);
-
-  // Return the pointer to the created PHI node in the corresponding argument
-  return CounterPhi;
-}
-
 /* Add Loop around the instruction I
  * Algorithm:
  * (1) Split the basic block of instruction I into three parts, where the
diff --git a/hpvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp b/hpvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp
index 4653ad0f8a..0559e8136d 100644
--- a/hpvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp
+++ b/hpvm/lib/Transforms/DFG2LLVM_CUDNN/DFG2LLVM_CUDNN.cpp
@@ -540,9 +540,6 @@ void CGT_CUDNN::codeGen(DFLeafNode *N) {
       case Intrinsic::hpvm_node_id: { /* llvm.hpvm.node.id */
         DEBUG(errs() << F_cudnn->getName()
                      << "\t: Handling Node ID Intrinsic \n");
-        // Get uint32 argument
-        Value *Op = II->getOperand(0);
-
         // Argument list for the runtime call
         std::vector<Value *> Args;
         Args.push_back(II->getOperand(0));
diff --git a/hpvm/projects/hpvm-tensor-rt/soc_simulator/promise_timing_model.cpp b/hpvm/projects/hpvm-tensor-rt/soc_simulator/promise_timing_model.cpp
index 87150f45a3..5bcd8173a5 100644
--- a/hpvm/projects/hpvm-tensor-rt/soc_simulator/promise_timing_model.cpp
+++ b/hpvm/projects/hpvm-tensor-rt/soc_simulator/promise_timing_model.cpp
@@ -27,7 +27,7 @@ Scratchpad::Scratchpad(const bool enable,
            const unsigned size,
            const double dram_latency,
            const double dram_bandwidth)
-    : enable_(enable), dram_(dram_latency, dram_bandwidth) {
+    : dram_(dram_latency, dram_bandwidth), enable_(enable) {
 
     num_lines_ = size / line_size;
     lines_.resize(num_lines_);
@@ -78,7 +78,7 @@ std::pair<double, double> Scratchpad::access(const unsigned address,
 
     // Keep reading line by line until everything is read
     while (num_bytes_remaining > 0) {
-        if (lines_[getIndex(addr)] == address) {
+        if ((unsigned) lines_[getIndex(addr)] == address) {
             // Hit
             hits++;
         } else {
-- 
GitLab