[poolalloc] r238045 - Fix compilation against latest LLVM, use nullptr for GEP type for now.

Will Dietz wdietz2 at illinois.edu
Fri May 22 13:16:24 PDT 2015


Author: wdietz2
Date: Fri May 22 15:16:23 2015
New Revision: 238045

URL: http://llvm.org/viewvc/llvm-project?rev=238045&view=rev
Log:
Fix compilation against latest LLVM, use nullptr for GEP type for now.

Tests do not pass yet.


Modified:
    poolalloc/trunk/lib/AssistDS/GEPExprArgs.cpp
    poolalloc/trunk/lib/AssistDS/MergeGEP.cpp
    poolalloc/trunk/lib/AssistDS/SimplifyGEP.cpp
    poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
    poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
    poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp

Modified: poolalloc/trunk/lib/AssistDS/GEPExprArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/GEPExprArgs.cpp?rev=238045&r1=238044&r2=238045&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/GEPExprArgs.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/GEPExprArgs.cpp Fri May 22 15:16:23 2015
@@ -142,9 +142,8 @@ bool GEPExprArgs::runOnModule(Module& M)
           NI = NewF->arg_begin();
           SmallVector<Value*, 8> Indices;
           Indices.append(GEP->op_begin()+1, GEP->op_end());
-          GetElementPtrInst *GEP_new = GetElementPtrInst::Create(cast<Value>(NI),
-                                                                 Indices, 
-                                                                 "", InsertPoint);
+          GetElementPtrInst *GEP_new = GetElementPtrInst::Create(
+              nullptr, cast<Value>(NI), Indices, "", InsertPoint);
           fargs.at(argNum)->replaceAllUsesWith(GEP_new);
           unsigned j = argNum + 1;
           for(; j < CI->getNumOperands();j++) {

Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/MergeGEP.cpp?rev=238045&r1=238044&r2=238045&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/MergeGEP.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Fri May 22 15:16:23 2015
@@ -142,7 +142,7 @@ static void simplifyGEP(GetElementPtrIns
       GetElementPtrInst *GEPNew =  (GEP->isInBounds() && Src->isInBounds()) ?
         GetElementPtrInst::CreateInBounds(Src->getOperand(0), Indices,
                                           GEP->getName(), GEP) :
-        GetElementPtrInst::Create(Src->getOperand(0), Indices,
+        GetElementPtrInst::Create(nullptr, Src->getOperand(0), Indices,
                                   GEP->getName(), GEP);
       numMerged++;
       GEP->replaceAllUsesWith(GEPNew);

Modified: poolalloc/trunk/lib/AssistDS/SimplifyGEP.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/SimplifyGEP.cpp?rev=238045&r1=238044&r2=238045&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/SimplifyGEP.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/SimplifyGEP.cpp Fri May 22 15:16:23 2015
@@ -106,8 +106,8 @@ bool SimplifyGEP::runOnModule(Module& M)
               if (CATy->getElementType() == StrippedPtrTy->getElementType()) {
                 // -> GEP i8* X, ...
                 SmallVector<Value*, 8> Idx(GEP->idx_begin()+1, GEP->idx_end());
-                GetElementPtrInst *Res =
-                  GetElementPtrInst::Create(StrippedPtr, Idx, GEP->getName(), GEP);
+                GetElementPtrInst *Res = GetElementPtrInst::Create(
+                    nullptr, StrippedPtr, Idx, GEP->getName(), GEP);
                 Res->setIsInBounds(GEP->isInBounds());
                 GEP->replaceAllUsesWith(Res);
                 continue;
@@ -139,8 +139,8 @@ bool SimplifyGEP::runOnModule(Module& M)
               Value *Idx[2];
               Idx[0] = Constant::getNullValue(Type::getInt32Ty(GEP->getContext()));
               Idx[1] = GEP->getOperand(1);
-              Value *NewGEP = GetElementPtrInst::Create(StrippedPtr, Idx,
-                                                        GEP->getName(), GEP);
+              Value *NewGEP = GetElementPtrInst::Create(
+                  nullptr, StrippedPtr, Idx, GEP->getName(), GEP);
               // V and GEP are both pointer types --> BitCast
               GEP->replaceAllUsesWith(new BitCastInst(NewGEP, GEP->getType(), GEP->getName(), GEP));
               continue;
@@ -198,8 +198,8 @@ bool SimplifyGEP::runOnModule(Module& M)
                 Value *Idx[2];
                 Idx[0] = Constant::getNullValue(Type::getInt32Ty(GEP->getContext()));
                 Idx[1] = NewIdx;
-                Value *NewGEP = GetElementPtrInst::Create(StrippedPtr, Idx,
-                                                          GEP->getName(), GEP);
+                Value *NewGEP = GetElementPtrInst::Create(
+                    nullptr, StrippedPtr, Idx, GEP->getName(), GEP);
                 GEP->replaceAllUsesWith(new BitCastInst(NewGEP, GEP->getType(), GEP->getName(), GEP));
                 continue;
               }

Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=238045&r1=238044&r2=238045&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Fri May 22 15:16:23 2015
@@ -610,7 +610,7 @@ void TypeChecks::addTypeMap(Module &M) {
                                           CA,
                                           "");
   GV->setInitializer(CA);
-  Constant *C = ConstantExpr::getGetElementPtr(GV,Indices);
+  Constant *C = ConstantExpr::getGetElementPtr(nullptr, GV,Indices);
   Values[0] = C;
 
   // For each used type, create a new entry. 
@@ -632,7 +632,7 @@ void TypeChecks::addTypeMap(Module &M) {
                                             CA,
                                             "");
     GV->setInitializer(CA);
-    Constant *C = ConstantExpr::getGetElementPtr(GV, Indices);
+    Constant *C = ConstantExpr::getGetElementPtr(nullptr, GV, Indices);
     Values[TI->second]= C;
   }
 
@@ -1529,7 +1529,7 @@ bool TypeChecks::visitCallSite(Module &M
           return true;
         }
 
-      case Intrinsic::memset:
+      case Intrinsic::memset:{
         Value *BCI = castTo(CS.getArgument(0), VoidPtrTy, "", I);
         std::vector<Value *> Args;
         Args.push_back(BCI);
@@ -1539,6 +1539,10 @@ bool TypeChecks::visitCallSite(Module &M
         CallInst::Create(trackInitInst, Args, "", I);
         return true;
       }
+      default:
+        // Unhandled intrinsic, do nothing. (??)
+        return false;
+      }
     } else if (F->getName().str() == std::string("_ZNKSs5c_strEv")) { //c_str
       std::vector<Value *>Args;
       Args.push_back(I);

Modified: poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp?rev=238045&r1=238044&r2=238045&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp Fri May 22 15:16:23 2015
@@ -297,8 +297,8 @@ Value *CompressedPoolInfo::EmitPoolBaseL
     // Get the pool base pointer.
     Constant *Zero = ConstantInt::get(Int32Type, 0);
     Value *Opts[2] = {Zero, Zero};
-    Value *BasePtrPtr = GetElementPtrInst::Create(getPoolDesc(), Opts,
-                                              "poolbaseptrptr", &I);
+    Value *BasePtrPtr = GetElementPtrInst::Create(nullptr, getPoolDesc(), Opts,
+                                                  "poolbaseptrptr", &I);
     return new LoadInst(BasePtrPtr, "poolbaseptr", &I);
   } else {
     // If this is a pool descriptor passed into the function, and this is the
@@ -309,8 +309,8 @@ Value *CompressedPoolInfo::EmitPoolBaseL
       while (isa<AllocaInst>(IP)) ++IP;
       Constant *Zero = ConstantInt::get(Int32Type, 0);
       Value *Opts[2] = {Zero, Zero};
-      Value *BasePtrPtr = GetElementPtrInst::Create(getPoolDesc(), Opts,
-                                                "poolbaseptrptr", IP);
+      Value *BasePtrPtr = GetElementPtrInst::Create(nullptr, getPoolDesc(),
+                                                    Opts, "poolbaseptrptr", IP);
       PoolBase = new LoadInst(BasePtrPtr, "poolbaseptr", IP);
     }
     
@@ -783,8 +783,9 @@ void InstructionRewriter::visitLoadInst(
   Value* Ops = getTransformedValue(LI.getOperand(0));
   if (Ops->getType() == Int16Type)
     Ops = CastInst::CreateZExtOrBitCast(Ops, Int32Type, "extend_idx", &LI);
-  Value *SrcPtr = GetElementPtrInst::Create(BasePtr, Ops,
-                                        LI.getOperand(0)->getName()+".pp", &LI);
+  Value *SrcPtr = GetElementPtrInst::Create(nullptr, BasePtr, Ops,
+                                            LI.getOperand(0)->getName()+".pp",
+                                            &LI);
   Type *DestTy = LoadingCompressedPtr ? MEMUINTTYPE : LI.getType();
   SrcPtr = CastInst::CreatePointerCast(SrcPtr, PointerType::getUnqual(DestTy),
                                       SrcPtr->getName(), &LI);
@@ -849,9 +850,8 @@ void InstructionRewriter::visitStoreInst
   if (Ops->getType() == Int16Type)
     Ops = CastInst::CreateZExtOrBitCast(Ops, Int32Type, "extend_idx", &SI);
 
-  Value *DestPtr = GetElementPtrInst::Create(BasePtr, Ops,
-                                         SI.getOperand(1)->getName()+".pp",
-                                         &SI);
+  Value *DestPtr = GetElementPtrInst::Create(
+      nullptr, BasePtr, Ops, SI.getOperand(1)->getName() + ".pp", &SI);
   DestPtr = CastInst::CreatePointerCast(DestPtr,
                                         PointerType::getUnqual(SrcVal->getType()),
                                         DestPtr->getName(), &SI);
@@ -980,8 +980,9 @@ void InstructionRewriter::visitCallInst(
     } else if (Callee->getName() == "read") {
       if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(2))) {
         Value *BasePtr = DestPI->EmitPoolBaseLoad(CI);
-        Value *SrcPtr = GetElementPtrInst::Create(BasePtr, getTransformedValue(CI.getOperand(2)),
-                                       CI.getOperand(2)->getName()+".pp", &CI);
+        Value *SrcPtr = GetElementPtrInst::Create(
+            nullptr, BasePtr, getTransformedValue(CI.getOperand(2)),
+            CI.getOperand(2)->getName() + ".pp", &CI);
         SrcPtr = CastInst::CreatePointerCast(SrcPtr, CI.getOperand(2)->getType(), "", &CI);
         CI.setOperand(2, SrcPtr);
         return;
@@ -989,8 +990,9 @@ void InstructionRewriter::visitCallInst(
     } else if (Callee->getName() == "fwrite") {
       if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(1))) {
         Value *BasePtr = DestPI->EmitPoolBaseLoad(CI);
-        Value *SrcPtr = GetElementPtrInst::Create(BasePtr, getTransformedValue(CI.getOperand(1)),
-                                       CI.getOperand(1)->getName()+".pp", &CI);
+        Value *SrcPtr = GetElementPtrInst::Create(
+            nullptr, BasePtr, getTransformedValue(CI.getOperand(1)),
+            CI.getOperand(1)->getName() + ".pp", &CI);
         SrcPtr = CastInst::CreatePointerCast(SrcPtr, CI.getOperand(1)->getType(), "", &CI);
         CI.setOperand(1, SrcPtr);
         return;
@@ -1000,8 +1002,9 @@ void InstructionRewriter::visitCallInst(
                Callee->getName() == "llvm.memset.i64") {
       if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(1))) {
         Value *BasePtr = DestPI->EmitPoolBaseLoad(CI);
-        Value *SrcPtr = GetElementPtrInst::Create(BasePtr, getTransformedValue(CI.getOperand(1)),
-                                       CI.getOperand(1)->getName()+".pp", &CI);
+        Value *SrcPtr = GetElementPtrInst::Create(
+            nullptr, BasePtr, getTransformedValue(CI.getOperand(1)),
+            CI.getOperand(1)->getName() + ".pp", &CI);
         SrcPtr = CastInst::CreatePointerCast(SrcPtr, CI.getOperand(1)->getType(), "", &CI);
         CI.setOperand(1, SrcPtr);
         return;
@@ -1012,16 +1015,18 @@ void InstructionRewriter::visitCallInst(
       bool doret = false;
       if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(1))) {
         Value *BasePtr = DestPI->EmitPoolBaseLoad(CI);
-        Value *SrcPtr = GetElementPtrInst::Create(BasePtr, getTransformedValue(CI.getOperand(1)),
-                                       CI.getOperand(1)->getName()+".pp", &CI);
+        Value *SrcPtr = GetElementPtrInst::Create(
+            nullptr, BasePtr, getTransformedValue(CI.getOperand(1)),
+            CI.getOperand(1)->getName() + ".pp", &CI);
         SrcPtr = CastInst::CreatePointerCast(SrcPtr, CI.getOperand(1)->getType(), "", &CI);
         CI.setOperand(1, SrcPtr);
         doret = true;
       }
       if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(2))) {
         Value *BasePtr = DestPI->EmitPoolBaseLoad(CI);
-        Value *SrcPtr = GetElementPtrInst::Create(BasePtr, getTransformedValue(CI.getOperand(2)),
-                                       CI.getOperand(2)->getName()+".pp", &CI);
+        Value *SrcPtr = GetElementPtrInst::Create(
+            nullptr, BasePtr, getTransformedValue(CI.getOperand(2)),
+            CI.getOperand(2)->getName() + ".pp", &CI);
         SrcPtr = CastInst::CreatePointerCast(SrcPtr, CI.getOperand(2)->getType(), "", &CI);
         CI.setOperand(2, SrcPtr);
         doret = true;

Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=238045&r1=238044&r2=238045&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Fri May 22 15:16:23 2015
@@ -910,8 +910,9 @@ void FuncTransform::visitCallSite(CallSi
     //
     const DSCallGraph & callGraph = Graphs.getCallGraph();
 
-    DSCallGraph::callee_iterator I = callGraph.callee_begin(OrigInst);
-    for (; I != callGraph.callee_end(OrigInst); ++I) {
+    CallSite OrigCS(OrigInst);
+    DSCallGraph::callee_iterator I = callGraph.callee_begin(OrigCS);
+    for (; I != callGraph.callee_end(OrigCS); ++I) {
       for(DSCallGraph::scc_iterator sccii = callGraph.scc_begin(*I),
                            sccee = callGraph.scc_end(*I); sccii != sccee; ++sccii){
         if(SM.find(SM.getLeaderForGlobal(*sccii)) == SM.end())
@@ -993,7 +994,7 @@ void FuncTransform::visitCallSite(CallSi
 
 #ifndef NDEBUG
     // Verify that all potential callees at call site have the same DS graph.
-    DSCallGraph::callee_iterator E = Graphs.getCallGraph().callee_end(OrigInst);
+    DSCallGraph::callee_iterator E = Graphs.getCallGraph().callee_end(OrigCS);
     for (; I != E; ++I) {
       const Function * F = *I;
       assert (F);





More information about the llvm-commits mailing list