Skip to content

Commit

Permalink
fix build for LLVM 68b03aee1a15678
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoplopes committed Apr 7, 2020
1 parent e8f66bd commit 8a3606a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
6 changes: 4 additions & 2 deletions llvm_util/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ bool hasOpaqueType(llvm::Type *ty) {
for (auto elemty : aty->elements())
if (hasOpaqueType(elemty))
return true;
} else if (auto sty = llvm::dyn_cast<llvm::SequentialType>(ty))
return hasOpaqueType(sty->getElementType());
} else if (auto aty = llvm::dyn_cast<llvm::ArrayType>(ty))
return hasOpaqueType(aty->getElementType());
else if (auto vty = llvm::dyn_cast<llvm::VectorType>(ty))
return hasOpaqueType(vty->getElementType());

return false;
}
Expand Down
18 changes: 14 additions & 4 deletions tools/alive-tv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,24 @@ static int cmpTypes(llvm::Type *TyL, llvm::Type *TyR,
return 0;
}

case llvm::Type::ArrayTyID:
case llvm::Type::VectorTyID: {
auto *STyL = llvm::cast<llvm::SequentialType>(TyL);
auto *STyR = llvm::cast<llvm::SequentialType>(TyR);
case llvm::Type::ArrayTyID: {
auto *STyL = llvm::cast<llvm::ArrayType>(TyL);
auto *STyR = llvm::cast<llvm::ArrayType>(TyR);
if (STyL->getNumElements() != STyR->getNumElements())
return cmpNumbers(STyL->getNumElements(), STyR->getNumElements());
return cmpTypes(STyL->getElementType(), STyR->getElementType(), FnL, FnR);
}
case llvm::Type::VectorTyID: {
auto *STyL = llvm::cast<llvm::VectorType>(TyL);
auto *STyR = llvm::cast<llvm::VectorType>(TyR);
if (STyL->getElementCount().Scalable != STyR->getElementCount().Scalable)
return cmpNumbers(STyL->getElementCount().Scalable,
STyR->getElementCount().Scalable);
if (STyL->getElementCount().Min != STyR->getElementCount().Min)
return cmpNumbers(STyL->getElementCount().Min,
STyR->getElementCount().Min);
return cmpTypes(STyL->getElementType(), STyR->getElementType(), FnL, FnR);
}
}
}

Expand Down

0 comments on commit 8a3606a

Please sign in to comment.