Skip to content

Commit

Permalink
Fix incorrect GEP types, introduced during LLVM 3.7 compatibility fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
smowton committed Jun 14, 2016
1 parent cfdd3a3 commit f4b35d2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions llpe/main/ArgSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static Constant* getStringPtrArray(std::string& bytes, std::vector<size_t>& line
size_t start = lineStarts[i];

Constant* gepArgs[] = { Zero, ConstantInt::get(Int64, start) };
lineStartConsts.push_back(ConstantExpr::getGetElementPtr(I8P, EnvInitG, gepArgs));
lineStartConsts.push_back(ConstantExpr::getGetElementPtr(0, EnvInitG, gepArgs));

}

Expand All @@ -82,7 +82,7 @@ static Constant* getStringPtrArray(std::string& bytes, std::vector<size_t>& line
Constant* PtrArray = ConstantArray::get(PtrArrT, lineStartConsts);
GlobalVariable* EnvPtrsG = new GlobalVariable(M, PtrArray->getType(), true, GlobalValue::PrivateLinkage, PtrArray, "spec_env_ptrs");
Constant* gepArgs[] = { Zero, Zero };
Constant* EnvPtrsPtr = ConstantExpr::getGetElementPtr(PtrArray->getType(), EnvPtrsG, gepArgs);
Constant* EnvPtrsPtr = ConstantExpr::getGetElementPtr(0, EnvPtrsG, gepArgs);

return EnvPtrsPtr;

Expand Down Expand Up @@ -154,7 +154,7 @@ void LLPEAnalysisPass::loadArgv(Function* F, std::string& path, unsigned argvIdx

// Get a pointer into the constant argv:
Constant* gepArgs[] = { ConstantInt::get(Int64, 0), ConstantInt::get(Int64, lineStarts[i]) };
Constant* stringPtr = ConstantExpr::getGetElementPtr(BytePtr, ArgvConsts, gepArgs);
Constant* stringPtr = ConstantExpr::getGetElementPtr(0, ArgvConsts, gepArgs);

// Get a pointer into the real argv:
Constant* gepArg = ConstantInt::get(Int64, i);
Expand Down
4 changes: 2 additions & 2 deletions llpe/main/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ void LLPEAnalysisPass::parsePathConditions(cl::list<std::string>& L, PathConditi

if(assumeC->getType() != GInt8Ptr)
assumeC = ConstantExpr::getBitCast(assumeC, GInt8Ptr);
assumeC = ConstantExpr::getGetElementPtr(GInt8Ptr, assumeC, ConstantInt::get(GInt64, Offset));
assumeC = ConstantExpr::getGetElementPtr(0, assumeC, ConstantInt::get(GInt64, Offset));

}

Expand Down Expand Up @@ -692,7 +692,7 @@ void LLPEAnalysisPass::parseArgs(Function& F, std::vector<Constant*>& argConstan
Constant* GStr = new GlobalVariable(Str->getType(), true, GlobalValue::InternalLinkage, Str, "specstr");
Constant* Zero = ConstantInt::get(Type::getInt64Ty(F.getContext()), 0);
Constant* GEPArgs[] = { Zero, Zero };
Constant* StrPtr = ConstantExpr::getGetElementPtr(StrTy, GStr, GEPArgs, 2);
Constant* StrPtr = ConstantExpr::getGetElementPtr(0, GStr, GEPArgs, 2);
CHECK_ARG(idx, argConstants);
argConstants[idx] = StrPtr;

Expand Down
4 changes: 2 additions & 2 deletions llpe/main/Save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ bool IntegrationAttempt::emitVFSCall(ShadowBB* BB, ShadowInstruction* I, SmallVe

Constant* ZeroIdx = ConstantInt::get(Int64Ty, 0);
Constant* Idxs[2] = {ZeroIdx, ZeroIdx};
Constant* CopySource = ConstantExpr::getGetElementPtr(VoidPtrTy, ArrayGlobal, Idxs, 2);
Constant* CopySource = ConstantExpr::getGetElementPtr(0, ArrayGlobal, Idxs, 2);

Constant* MemcpySize = ConstantInt::get(Int64Ty, it->second.readSize);

Expand Down Expand Up @@ -2040,7 +2040,7 @@ Constant* llvm::getGVOffset(Constant* GV, int64_t Offset, Type* targetType) {
OffsetGV = CastGV;
else {
Constant* OffC = ConstantInt::get(Type::getInt64Ty(GV->getContext()), (uint64_t)Offset, true);
OffsetGV = ConstantExpr::getGetElementPtr(Int8Ptr, CastGV, OffC);
OffsetGV = ConstantExpr::getGetElementPtr(0, CastGV, OffC);
}

// Cast to proper type:
Expand Down

0 comments on commit f4b35d2

Please sign in to comment.