fix build for LLVM
MODIFY
llvm_util/utils.cpp
llvm_util/utils.cpp
@@ -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;
}

MODIFY
tools/alive-tv.cpp
tools/alive-tv.cpp
@@ -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);
+ }
}
}

fix build for LLVM 68b03aee1a15678