diff --git a/gen/dibuilder.cpp b/gen/dibuilder.cpp index 106291ae07..f93656a114 100644 --- a/gen/dibuilder.cpp +++ b/gen/dibuilder.cpp @@ -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() +#endif + ; instr->setDebugLoc(IR->ir->getCurrentDebugLocation()); } diff --git a/gen/optimizer.cpp b/gen/optimizer.cpp index 76b37eb118..74312c5c02 100644 --- a/gen/optimizer.cpp +++ b/gen/optimizer.cpp @@ -308,6 +308,9 @@ static llvm::Optional 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( @@ -316,6 +319,9 @@ static llvm::Optional 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( @@ -324,6 +330,9 @@ static llvm::Optional 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 diff --git a/runtime/druntime/src/ldc/intrinsics.di b/runtime/druntime/src/ldc/intrinsics.di index 485ffc8c47..ab73a80734 100644 --- a/runtime/druntime/src/ldc/intrinsics.di +++ b/runtime/druntime/src/ldc/intrinsics.di @@ -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);