Skip to content

Commit

Permalink
Get it to compile
Browse files Browse the repository at this point in the history
  • Loading branch information
thewilsonator committed Feb 23, 2017
1 parent fb728b9 commit d38eecb
Show file tree
Hide file tree
Showing 12 changed files with 6,509 additions and 6,501 deletions.
2,914 changes: 1,457 additions & 1,457 deletions OCL20ToSPIRV.cpp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions OCLTypeToSPIRV.cpp
Expand Up @@ -125,7 +125,7 @@ static unsigned
getArgIndex(Function *F, Value *V) {
auto A = F->arg_begin(), E = F->arg_end();
for (unsigned I = 0; A != E; ++I, ++A) {
if (A == V)
if (&*A == V)
return I;
}
llvm_unreachable("Not argument of function");
Expand All @@ -136,7 +136,7 @@ static Argument*
getArg(Function *F, unsigned I) {
auto AI = F->arg_begin();
std::advance(AI, I);
return AI;
return &*AI;
}

/// Create a new function type if \param F has arguments in AdaptedTy, and
Expand Down Expand Up @@ -291,7 +291,7 @@ OCLTypeToSPIRV::adaptArgumentsByMetadata(Function* F) {
auto OCLTyStr = getMDOperandAsString(TypeMD, I);
auto NewTy = *PI;
if (OCLTyStr == OCL_TYPE_NAME_SAMPLER_T && !NewTy->isStructTy()) {
addAdaptedType(Arg, getSamplerType(M));
addAdaptedType(&*Arg, getSamplerType(M));
Changed = true;
} else if (isPointerToOpaqueStructType(NewTy)) {
auto STName = NewTy->getPointerElementType()->getStructName();
Expand All @@ -301,7 +301,7 @@ OCLTypeToSPIRV::adaptArgumentsByMetadata(Function* F) {
auto AccMD = getArgAccessQualifierMetadata(F);
assert(AccMD && "Invalid access qualifier metadata");
auto AccStr = getMDOperandAsString(AccMD, I);
addAdaptedType(Arg, getOrCreateOpaquePtrType(M,
addAdaptedType(&*Arg, getOrCreateOpaquePtrType(M,
mapOCLTypeNameToSPIRV(Ty, AccStr)));
Changed = true;
}
Expand Down
6 changes: 3 additions & 3 deletions SPIRVLowerConstExpr.cpp
Expand Up @@ -120,7 +120,7 @@ SPIRVLowerConstExpr::visit(Module *M) {
auto FBegin = I->begin();
for (auto BI = FBegin, BE = I->end(); BI != BE; ++BI) {
for (auto II = BI->begin(), IE = BI->end(); II != IE; ++II) {
WorkList.push_back(II);
WorkList.push_back(&*II);
}
}
while (!WorkList.empty()) {
Expand All @@ -132,7 +132,7 @@ SPIRVLowerConstExpr::visit(Module *M) {
if (auto CE = dyn_cast<ConstantExpr>(Op)) {
SPIRVDBG(dbgs() << "[lowerConstantExpressions] " << *CE;)
auto ReplInst = CE->getAsInstruction();
ReplInst->insertBefore(FBegin->begin());
ReplInst->insertBefore(&*FBegin->begin());
SPIRVDBG(dbgs() << " -> " << *ReplInst << '\n';)
WorkList.push_front(ReplInst);
std::vector<Instruction *> Users;
Expand All @@ -141,7 +141,7 @@ SPIRVLowerConstExpr::visit(Module *M) {
SPIRVDBG(dbgs() << "[lowerConstantExpressions] Use: " <<
*U << '\n';)
if (auto InstUser = dyn_cast<Instruction>(U)) {
if (InstUser->getParent()->getParent() != I)
if (InstUser->getParent()->getParent() != &*I)
continue;
Users.push_back(InstUser);
}
Expand Down

0 comments on commit d38eecb

Please sign in to comment.