diff options
| author | bors <bors@rust-lang.org> | 2024-04-15 16:46:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-15 16:46:59 +0000 |
| commit | 99d0186b1d0547eae913eff04be272c9d348b9b8 (patch) | |
| tree | 2048699106c48707603dd1bc9b25a1e38cf11071 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 023084804e5e8ea42877451c2b3030e7050281cc (diff) | |
| parent | 723c0e23bcc43baa2f7ad6f6ef60f96b3cf169eb (diff) | |
| download | rust-99d0186b1d0547eae913eff04be272c9d348b9b8.tar.gz rust-99d0186b1d0547eae913eff04be272c9d348b9b8.zip | |
Auto merge of #123968 - jieyouxu:rollup-1pnkxor, r=jieyouxu
Rollup of 12 pull requests Successful merges: - #123423 (Distribute LLVM bitcode linker as a preview component) - #123548 (libtest: also measure time in Miri) - #123666 (Fix some typos in doc) - #123864 (Remove a HACK by instead inferring opaque types during expected/formal type checking) - #123896 (Migrate some diagnostics in `rustc_resolve` to session diagnostic) - #123919 (builtin-derive: tag → discriminant) - #123922 (Remove magic constants when using `base_n`.) - #123931 (Don't leak unnameable types in `-> _` recover) - #123933 (move the LargeAssignments lint logic into its own file) - #123934 (`rustc_data_structures::graph` mini refactor) - #123941 (Fix UB in LLVM FFI when passing zero or >1 bundle) - #123957 (disable create_dir_all_bare test on all(miri, windows)) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 37c2da4c23a..6e11fd629e4 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1524,13 +1524,21 @@ extern "C" void LLVMRustFreeOperandBundleDef(OperandBundleDef *Bundle) { extern "C" LLVMValueRef LLVMRustBuildCall(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, - OperandBundleDef **OpBundles, + OperandBundleDef **OpBundlesIndirect, unsigned NumOpBundles) { Value *Callee = unwrap(Fn); FunctionType *FTy = unwrap<FunctionType>(Ty); + + // FIXME: Is there a way around this? + SmallVector<OperandBundleDef> OpBundles; + OpBundles.reserve(NumOpBundles); + for (unsigned i = 0; i < NumOpBundles; ++i) { + OpBundles.push_back(*OpBundlesIndirect[i]); + } + return wrap(unwrap(B)->CreateCall( FTy, Callee, ArrayRef<Value*>(unwrap(Args), NumArgs), - ArrayRef<OperandBundleDef>(*OpBundles, NumOpBundles))); + ArrayRef<OperandBundleDef>(OpBundles))); } extern "C" LLVMValueRef LLVMRustGetInstrProfIncrementIntrinsic(LLVMModuleRef M) { @@ -1570,13 +1578,21 @@ extern "C" LLVMValueRef LLVMRustBuildInvoke(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, - OperandBundleDef **OpBundles, unsigned NumOpBundles, + OperandBundleDef **OpBundlesIndirect, unsigned NumOpBundles, const char *Name) { Value *Callee = unwrap(Fn); FunctionType *FTy = unwrap<FunctionType>(Ty); + + // FIXME: Is there a way around this? + SmallVector<OperandBundleDef> OpBundles; + OpBundles.reserve(NumOpBundles); + for (unsigned i = 0; i < NumOpBundles; ++i) { + OpBundles.push_back(*OpBundlesIndirect[i]); + } + return wrap(unwrap(B)->CreateInvoke(FTy, Callee, unwrap(Then), unwrap(Catch), ArrayRef<Value*>(unwrap(Args), NumArgs), - ArrayRef<OperandBundleDef>(*OpBundles, NumOpBundles), + ArrayRef<OperandBundleDef>(OpBundles), Name)); } @@ -1585,7 +1601,7 @@ LLVMRustBuildCallBr(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMBasicBlockRef DefaultDest, LLVMBasicBlockRef *IndirectDests, unsigned NumIndirectDests, LLVMValueRef *Args, unsigned NumArgs, - OperandBundleDef **OpBundles, unsigned NumOpBundles, + OperandBundleDef **OpBundlesIndirect, unsigned NumOpBundles, const char *Name) { Value *Callee = unwrap(Fn); FunctionType *FTy = unwrap<FunctionType>(Ty); @@ -1597,11 +1613,18 @@ LLVMRustBuildCallBr(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn, IndirectDestsUnwrapped.push_back(unwrap(IndirectDests[i])); } + // FIXME: Is there a way around this? + SmallVector<OperandBundleDef> OpBundles; + OpBundles.reserve(NumOpBundles); + for (unsigned i = 0; i < NumOpBundles; ++i) { + OpBundles.push_back(*OpBundlesIndirect[i]); + } + return wrap(unwrap(B)->CreateCallBr( FTy, Callee, unwrap(DefaultDest), ArrayRef<BasicBlock*>(IndirectDestsUnwrapped), ArrayRef<Value*>(unwrap(Args), NumArgs), - ArrayRef<OperandBundleDef>(*OpBundles, NumOpBundles), + ArrayRef<OperandBundleDef>(OpBundles), Name)); } |
