Skip to content

Commit

Permalink
Fix some compilation errors for LLVM19/20
Browse files Browse the repository at this point in the history
  • Loading branch information
thewilsonator committed Aug 13, 2024
1 parent 6bd5d9a commit 77a8c20
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gen/dibuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,11 @@ void DIBuilder::EmitValue(llvm::Value *val, VarDeclaration *vd) {

llvm::Instruction *instr = DBuilder.insertDbgValueIntrinsic(
val, debugVariable, DBuilder.createExpression(),
IR->ir->getCurrentDebugLocation(), IR->scopebb());
IR->ir->getCurrentDebugLocation(), IR->scopebb())
#if LDC_LLVM_VER >= 1901
.dyn_cast<llvm::Instruction *>()
#endif
;
instr->setDebugLoc(IR->ir->getCurrentDebugLocation());
}

Expand Down
9 changes: 9 additions & 0 deletions gen/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ static llvm::Optional<PGOOptions> getPGOOptions() {
"" /*MemoryProfileUsePath*/, llvm::vfs::getRealFileSystem(),
#endif
PGOOptions::PGOAction::IRInstr, PGOOptions::CSPGOAction::NoCSAction,
#if LDC_LLVM_VER >= 1901
PGOOptions::ColdFuncOpt::Default,
#endif
debugInfoForProfiling, pseudoProbeForProfiling);
} else if (opts::isUsingIRBasedPGOProfile()) {
return PGOOptions(
Expand All @@ -316,6 +319,9 @@ static llvm::Optional<PGOOptions> getPGOOptions() {
"" /*MemoryProfileUsePath*/, llvm::vfs::getRealFileSystem(),
#endif
PGOOptions::PGOAction::IRUse, PGOOptions::CSPGOAction::NoCSAction,
#if LDC_LLVM_VER >= 1901
PGOOptions::ColdFuncOpt::Default,
#endif
debugInfoForProfiling, pseudoProbeForProfiling);
} else if (opts::isUsingSampleBasedPGOProfile()) {
return PGOOptions(
Expand All @@ -324,6 +330,9 @@ static llvm::Optional<PGOOptions> getPGOOptions() {
"" /*MemoryProfileUsePath*/, llvm::vfs::getRealFileSystem(),
#endif
PGOOptions::PGOAction::SampleUse, PGOOptions::CSPGOAction::NoCSAction,
#if LDC_LLVM_VER >= 1901
PGOOptions::ColdFuncOpt::Default,
#endif
debugInfoForProfiling, pseudoProbeForProfiling);
}
#if LDC_LLVM_VER < 1600
Expand Down
2 changes: 2 additions & 0 deletions runtime/druntime/src/ldc/intrinsics.di
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ else version (LDC_LLVM_1600) enum LLVM_version = 1600;
else version (LDC_LLVM_1700) enum LLVM_version = 1700;
else version (LDC_LLVM_1800) enum LLVM_version = 1800;
else version (LDC_LLVM_1801) enum LLVM_version = 1801;
else version (LDC_LLVM_1901) enum LLVM_version = 1901;
else version (LDC_LLVM_2000) enum LLVM_version = 2000;
else static assert(false, "LDC LLVM version not supported");

enum LLVM_atleast(int major) = (LLVM_version >= major * 100);
Expand Down

0 comments on commit 77a8c20

Please sign in to comment.