Skip to content

Commit

Permalink
Merge pull request #261 from hvdijk/llvm18
Browse files Browse the repository at this point in the history
More LLVM 18 fixups.
  • Loading branch information
hvdijk authored Dec 18, 2023
2 parents 6c335c1 + 74ba46d commit 65e6dfd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions modules/compiler/spirv-ll/source/builder_debug_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,9 +994,15 @@ llvm::Expected<llvm::MDNode *> DebugInfoBuilder::translate(
getIDAsStr(op->IdResult(), &module) +
" is not an OpConstant");
}
#if LLVM_VERSION_GREATER_EQUAL(18, 0)
return getDIBuilder(op).createStaticMemberType(
scope, *name, file, op->Line(), base_ty, flags,
cast<llvm::Constant>(val), llvm::dwarf::DW_TAG_variable);
#else
return getDIBuilder(op).createStaticMemberType(scope, *name, file,
op->Line(), base_ty, flags,
cast<llvm::Constant>(val));
#endif
}

auto size_or_error = getConstantIntValue(op->Size());
Expand Down
5 changes: 4 additions & 1 deletion modules/compiler/utils/source/barrier_regions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,10 @@ void compiler::utils::Barrier::MakeLiveVariableMemType() {

// Check if the alloca has a debug info source variable attached. If
// so record this and the matching byte offset into the struct.
#if LLVM_VERSION_GREATER_EQUAL(17, 0)
#if LLVM_VERSION_GREATER_EQUAL(18, 0)
SmallVector<DbgDeclareInst *, 1> DbgIntrinsics;
findDbgDeclares(DbgIntrinsics, member.value);
#elif LLVM_VERSION_GREATER_EQUAL(17, 0)
auto DbgIntrinsics = FindDbgDeclareUses(member.value);
#else
auto DbgIntrinsics = FindDbgAddrUses(member.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ bool BasicMem2RegPass::promoteAlloca(AllocaInst *Alloca) const {
StoredValue = Store->getValueOperand();
ToDelete.push_back(Store);
DIBuilder DIB(*Alloca->getModule(), /*AllowUnresolved*/ false);
#if LLVM_VERSION_GREATER_EQUAL(17, 0)
#if LLVM_VERSION_GREATER_EQUAL(18, 0)
SmallVector<DbgDeclareInst *, 1> DbgIntrinsics;
findDbgDeclares(DbgIntrinsics, Alloca);
#elif LLVM_VERSION_GREATER_EQUAL(17, 0)
auto DbgIntrinsics = FindDbgDeclareUses(Alloca);
#else
auto DbgIntrinsics = FindDbgAddrUses(Alloca);
Expand Down

0 comments on commit 65e6dfd

Please sign in to comment.