Skip to content

Commit

Permalink
[TypeAnalysisPrinter] support opaque pointers on 16 (#1629)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Jan 25, 2024
1 parent 2189e89 commit 5caf99a
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions enzyme/Enzyme/TypeAnalysis/TypeAnalysisPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,18 @@ bool printTypeAnalyses(llvm::Function &F) {
dt = ConcreteType(a.getType()->getScalarType());
} else if (a.getType()->isPointerTy()) {
#if LLVM_VERSION_MAJOR < 17
auto et = cast<PointerType>(a.getType())->getPointerElementType();
if (et->isFPOrFPVectorTy()) {
dt = TypeTree(ConcreteType(et->getScalarType())).Only(-1, nullptr);
} else if (et->isPointerTy()) {
dt = TypeTree(ConcreteType(BaseType::Pointer)).Only(-1, nullptr);
#if LLVM_VERSION_MAJOR >= 15
if (F.getContext().supportsTypedPointers()) {
#endif
auto et = cast<PointerType>(a.getType())->getPointerElementType();
if (et->isFPOrFPVectorTy()) {
dt = TypeTree(ConcreteType(et->getScalarType())).Only(-1, nullptr);
} else if (et->isPointerTy()) {
dt = TypeTree(ConcreteType(BaseType::Pointer)).Only(-1, nullptr);
}
#if LLVM_VERSION_MAJOR >= 15
}
#endif
#endif
dt.insert({}, BaseType::Pointer);
} else if (a.getType()->isIntOrIntVectorTy()) {
Expand All @@ -106,12 +112,18 @@ bool printTypeAnalyses(llvm::Function &F) {
dt = ConcreteType(F.getReturnType()->getScalarType());
} else if (F.getReturnType()->isPointerTy()) {
#if LLVM_VERSION_MAJOR < 17
auto et = cast<PointerType>(F.getReturnType())->getPointerElementType();
if (et->isFPOrFPVectorTy()) {
dt = TypeTree(ConcreteType(et->getScalarType())).Only(-1, nullptr);
} else if (et->isPointerTy()) {
dt = TypeTree(ConcreteType(BaseType::Pointer)).Only(-1, nullptr);
#if LLVM_VERSION_MAJOR >= 15
if (F.getContext().supportsTypedPointers()) {
#endif
auto et = cast<PointerType>(F.getReturnType())->getPointerElementType();
if (et->isFPOrFPVectorTy()) {
dt = TypeTree(ConcreteType(et->getScalarType())).Only(-1, nullptr);
} else if (et->isPointerTy()) {
dt = TypeTree(ConcreteType(BaseType::Pointer)).Only(-1, nullptr);
}
#if LLVM_VERSION_MAJOR >= 15
}
#endif
#endif
dt.insert({}, BaseType::Pointer);
} else if (F.getReturnType()->isIntOrIntVectorTy()) {
Expand Down

0 comments on commit 5caf99a

Please sign in to comment.