From b34da890694f5210e475f34018239fc9d126d1ee Mon Sep 17 00:00:00 2001 From: Marek Chalupa Date: Wed, 29 Nov 2023 13:46:37 +0100 Subject: [PATCH] Fix build for LLVM < 18 --- lib/llvm/PointerAnalysis/Instructions.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/llvm/PointerAnalysis/Instructions.cpp b/lib/llvm/PointerAnalysis/Instructions.cpp index d08d14722..6bece5296 100644 --- a/lib/llvm/PointerAnalysis/Instructions.cpp +++ b/lib/llvm/PointerAnalysis/Instructions.cpp @@ -127,7 +127,11 @@ Offset accumulateEVOffsets(const llvm::ExtractValueInst *EV, if (llvm::StructType *STy = llvm::dyn_cast(type)) { assert(STy->indexValid(idx) && "Invalid index"); const llvm::StructLayout *SL = DL.getStructLayout(STy); +#if LLVM_VERSION_MAJOR >= 18 off += SL->getElementOffset(idx).getFixedValue(); +#else + off += SL->getElementOffset(idx); +#endif } else { // array or vector, so just move in the array if (auto *arrTy = llvm::dyn_cast(type)) {