Skip to content

Commit

Permalink
Fix build for LLVM < 18
Browse files Browse the repository at this point in the history
  • Loading branch information
mchalupa committed Nov 29, 2023
1 parent a8ba793 commit b34da89
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/llvm/PointerAnalysis/Instructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ Offset accumulateEVOffsets(const llvm::ExtractValueInst *EV,
if (llvm::StructType *STy = llvm::dyn_cast<llvm::StructType>(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<llvm::ArrayType>(type)) {
Expand Down

0 comments on commit b34da89

Please sign in to comment.