Skip to content

Commit

Permalink
Update to LLVM main change (#1511)
Browse files Browse the repository at this point in the history
Co-authored-by: Billy Moses <wmoses@google.com>
  • Loading branch information
wsmoses and wsmoses authored Oct 31, 2023
1 parent e815387 commit 6b7bef6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions enzyme/Enzyme/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1916,8 +1916,13 @@ bool overwritesToMemoryReadBy(llvm::AAResults &AA, llvm::TargetLibraryInfo &TLI,
auto &DL = maybeWriter->getModule()->getDataLayout();
auto width = cast<IntegerType>(DL.getIndexType(LoadBegin->getType()))
->getBitWidth();
#if LLVM_VERSION_MAJOR >= 18
auto TS = SE.getConstant(
APInt(width, (int64_t)DL.getTypeStoreSize(LI->getType())));
#else
auto TS = SE.getConstant(
APInt(width, DL.getTypeStoreSize(LI->getType()).getFixedSize()));
#endif
LoadEnd = SE.getAddExpr(LoadBegin, TS);
}
}
Expand All @@ -1927,9 +1932,15 @@ bool overwritesToMemoryReadBy(llvm::AAResults &AA, llvm::TargetLibraryInfo &TLI,
auto &DL = maybeWriter->getModule()->getDataLayout();
auto width = cast<IntegerType>(DL.getIndexType(StoreBegin->getType()))
->getBitWidth();
#if LLVM_VERSION_MAJOR >= 18
auto TS =
SE.getConstant(APInt(width, (int64_t)DL.getTypeStoreSize(
SI->getValueOperand()->getType())));
#else
auto TS = SE.getConstant(
APInt(width, DL.getTypeStoreSize(SI->getValueOperand()->getType())
.getFixedSize()));
#endif
StoreEnd = SE.getAddExpr(StoreBegin, TS);
}
}
Expand Down

0 comments on commit 6b7bef6

Please sign in to comment.