Skip to content

Commit cc38393

Browse files
committed
Add compatibility with LLVM 22.x.
LLVM 22 removes the IntrusiveRefCntPtr<vfs::FileSystem> parameter from the PGOOptions constructor. The VFS was moved to PassBuilder directly (see llvm/llvm-project#160188), allowing all passes that need filesystem access to get it from PassBuilder rather than routing it through PGOOptions. Add LLVM_VERSION_MAJOR version guards to retain the FS argument for LLVM 17-21 while dropping it for LLVM 22+.
1 parent 3122f9e commit cc38393

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

core/iwasm/compilation/aot_llvm_extra.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,23 @@ aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx, LLVMModuleRef module)
212212
cl::ParseCommandLineOptions(2, argv);
213213
#if LLVM_VERSION_MAJOR < 17
214214
PGO = PGOOptions("", "", "", PGOOptions::IRInstr);
215-
#else
215+
#elif LLVM_VERSION_MAJOR < 22
216216
auto FS = vfs::getRealFileSystem();
217217
PGO = PGOOptions("", "", "", "", FS, PGOOptions::IRInstr);
218+
#else
219+
PGO = PGOOptions("", "", "", "", PGOOptions::IRInstr);
218220
#endif
219221
}
220222
else if (comp_ctx->use_prof_file) {
221223
#if LLVM_VERSION_MAJOR < 17
222224
PGO = PGOOptions(comp_ctx->use_prof_file, "", "", PGOOptions::IRUse);
223-
#else
225+
#elif LLVM_VERSION_MAJOR < 22
224226
auto FS = vfs::getRealFileSystem();
225227
PGO = PGOOptions(comp_ctx->use_prof_file, "", "", "", FS,
226228
PGOOptions::IRUse);
229+
#else
230+
PGO =
231+
PGOOptions(comp_ctx->use_prof_file, "", "", "", PGOOptions::IRUse);
227232
#endif
228233
}
229234

0 commit comments

Comments
 (0)