Use context methods instead of directly calling FFI

This commit is contained in:
Oli Scherer
2025-07-09 09:36:19 +00:00
parent b9baf63f99
commit 56d22cd29f
4 changed files with 9 additions and 25 deletions

View File

@@ -303,9 +303,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
}
let id_str = "branch_weights";
let id = unsafe {
llvm::LLVMMDStringInContext2(self.cx.llcx, id_str.as_ptr().cast(), id_str.len())
};
let id = self.cx.create_metadata(id_str.into());
// For switch instructions with 2 targets, the `llvm.expect` intrinsic is used.
// This function handles switch instructions with more than 2 targets and it needs to