[llvm-commits] [poolalloc] r129083 - in /poolalloc/trunk: include/assistDS/TypeAnalysis.h lib/AssistDS/TypeAnalysis.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Thu Apr 7 11:08:40 PDT 2011


Author: aggarwa4
Date: Thu Apr  7 13:08:40 2011
New Revision: 129083

URL: http://llvm.org/viewvc/llvm-project?rev=129083&view=rev
Log:
Extract/InsertValue instructions do not operate 
on data in memory, only in registers, so we dont
need to track them.

Modified:
    poolalloc/trunk/include/assistDS/TypeAnalysis.h
    poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp

Modified: poolalloc/trunk/include/assistDS/TypeAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/TypeAnalysis.h?rev=129083&r1=129082&r2=129083&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/TypeAnalysis.h (original)
+++ poolalloc/trunk/include/assistDS/TypeAnalysis.h Thu Apr  7 13:08:40 2011
@@ -33,14 +33,9 @@
 
     const Type *getType(LoadInst *);
     const Type *getType(StoreInst *);
-    const Type *getType(ExtractValueInst *);
-    const Type *getType(InsertValueInst *);
     bool isCopyingLoad(LoadInst *);
-    bool isCopyingLoad(ExtractValueInst *);
     bool isCopyingStore(StoreInst *);
-    bool isCopyingStore(InsertValueInst *);
     Value *getStoreSource(StoreInst *SI);
-    Value *getStoreSource(InsertValueInst *IVI);
   };
 }
 

Modified: poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp?rev=129083&r1=129082&r2=129083&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp Thu Apr  7 13:08:40 2011
@@ -9,6 +9,8 @@
 
 #include "assistDS/TypeAnalysis.h"
 #include <vector>
+#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/Debug.h"
 
 using namespace llvm;
 
@@ -27,22 +29,17 @@
 TypeAnalysis::runOnModule(Module& M) {
   return false;
 }
+
 const Type *
 TypeAnalysis::getType(LoadInst *LI){
   return LI->getType();
 }
+
 const Type *
 TypeAnalysis::getType(StoreInst *SI){
   return SI->getOperand(0)->getType();
 }
-const Type *
-TypeAnalysis::getType(InsertValueInst *I){
-  return I->getInsertedValueOperand()->getType();
-}
-const Type *
-TypeAnalysis::getType(ExtractValueInst *I){
-  return I->getType();
-}
+
 bool
 TypeAnalysis::isCopyingLoad(LoadInst *LI){
   if(LI->getNumUses() == 1) {
@@ -50,54 +47,22 @@
       if(SI->getOperand(0) == LI) {
         return true;
       }
-    } else if(InsertValueInst *IV = dyn_cast<InsertValueInst>(LI->use_begin())) {
-      if(IV->getInsertedValueOperand() == LI) {
-        return true;
-      }
-    }
-  }
-  return false;
-}
-bool 
-TypeAnalysis::isCopyingLoad(ExtractValueInst * EI) {
-  if(EI->getNumUses() == 1) {
-    if(StoreInst *SI = dyn_cast<StoreInst>(EI->use_begin())) {
-      if(SI->getOperand(0) == EI) {
-        return true;
-      }
-    } else if(InsertValueInst *IV = dyn_cast<InsertValueInst>(EI->use_begin())) {
-      if(IV->getInsertedValueOperand() == EI) {
-        return true;
-      }
     }
   }
+  // chk if passed through argument, and then stored.
   return false;
 }
+
+
 bool 
 TypeAnalysis::isCopyingStore(StoreInst *SI) {
   if(SI->getOperand(0)->getNumUses() == 1) {
     if(isa<LoadInst>(SI->getOperand(0))) {
       return true;
     }
-    else if(isa<ExtractValueInst>(SI->getOperand(0))) {
-      return true;
-    }
   }
   return false;
 }
-bool 
-TypeAnalysis::isCopyingStore(InsertValueInst *IVI) {
-  if(IVI->getInsertedValueOperand()->getNumUses() == 1) {
-    if(isa<LoadInst>(IVI->getInsertedValueOperand())) {
-      return true;
-    }
-    else if(isa<ExtractValueInst>(IVI->getInsertedValueOperand())) {
-      return true;
-    }
-  }
-
-  return false;
-}
 
 Value *
 TypeAnalysis::getStoreSource(StoreInst *SI) {
@@ -107,25 +72,6 @@
   return NULL;
 }
 
-Value *
-TypeAnalysis::getStoreSource(InsertValueInst *IVI) {
-  if(LoadInst *LI = dyn_cast<LoadInst>(IVI->getInsertedValueOperand())) {
-    return LI->getOperand(0);
-  }
-  else if(ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(IVI->getInsertedValueOperand())) {
-    SmallVector<Value*, 8> Indices;
-    Indices.reserve(EVI->getNumIndices());
-
-    for (unsigned i = 1, e = EVI->getNumOperands(); i != e; ++i) {
-      Value *Val = EVI->getOperand(i);
-      Indices.push_back(Val);
-    }
-    GetElementPtrInst *GEPInst =
-                      GetElementPtrInst::Create(EVI->getOperand(0), &Indices[0],&Indices[0] + EVI->getNumIndices(), "", EVI);
-    return GEPInst;
-  }
-  return NULL;
-}
 
 void 
 TypeAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {





More information about the llvm-commits mailing list