Skip to content

Commit ad23dfe

Browse files
committed
Auto merge of rust-lang#135763 - nikic:llvm-20, r=<try>
Update to LLVM 20 LLVM 20 GA is scheduled for March 11th. Rust 1.86 will be stable on April 3rd. * [x] rust-lang#135764 * [x] rust-lang#136134 * [x] rust-lang/compiler-builtins#752 * [ ] llvm/llvm-project#125287 * [ ] Update compiler-builtins (blocked on rust-lang#135501) Tested: host-x86_64, host-aarch64, apple, mingw try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: dist-aarch64-msvc try-job: x86_64-msvc-ext1 try-job: x86_64-msvc-ext2 try-job: x86_64-msvc-ext3
2 parents a5db378 + ee8284e commit ad23dfe

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+12-8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "llvm/Passes/StandardInstrumentations.h"
2323
#include "llvm/Support/CBindingWrapping.h"
2424
#include "llvm/Support/FileSystem.h"
25+
#include "llvm/Support/Program.h"
2526
#include "llvm/Support/TimeProfiler.h"
2627
#include "llvm/Support/VirtualFileSystem.h"
2728
#include "llvm/Target/TargetMachine.h"
@@ -472,16 +473,19 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
472473
assert(ArgsCstrBuff[ArgsCstrBuffLen - 1] == '\0');
473474
auto Arg0 = std::string(ArgsCstrBuff);
474475
buffer_offset = Arg0.size() + 1;
475-
auto ArgsCppStr = std::string(ArgsCstrBuff + buffer_offset,
476-
ArgsCstrBuffLen - buffer_offset);
477-
auto i = 0;
478-
while (i != std::string::npos) {
479-
i = ArgsCppStr.find('\0', i + 1);
480-
if (i != std::string::npos)
481-
ArgsCppStr.replace(i, 1, " ");
476+
477+
std::string CommandlineArgs;
478+
raw_string_ostream OS(CommandlineArgs);
479+
ListSeparator LS(" ");
480+
for (StringRef Arg : split(StringRef(ArgsCstrBuff + buffer_offset,
481+
ArgsCstrBuffLen - buffer_offset),
482+
'\0')) {
483+
OS << LS;
484+
sys::printArg(OS, Arg, /*Quote=*/true);
482485
}
486+
OS.flush();
483487
Options.MCOptions.Argv0 = Arg0;
484-
Options.MCOptions.CommandlineArgs = ArgsCppStr;
488+
Options.MCOptions.CommandlineArgs = CommandlineArgs;
485489
#else
486490
int buffer_offset = 0;
487491
assert(ArgsCstrBuff[ArgsCstrBuffLen - 1] == '\0');

src/llvm-project

tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ pub unsafe extern "ptx-kernel" fn f_float_array_arg(_a: [f32; 5]) {}
242242
//pub unsafe extern "ptx-kernel" fn f_u128_array_arg(_a: [u128; 5]) {}
243243

244244
// CHECK: .visible .entry f_u32_slice_arg(
245-
// CHECK: .param .u64 f_u32_slice_arg_param_0
245+
// CHECK: .param .u64 {{(\.ptr \.align 4 )?}}f_u32_slice_arg_param_0
246246
// CHECK: .param .u64 f_u32_slice_arg_param_1
247247
#[no_mangle]
248248
pub unsafe extern "ptx-kernel" fn f_u32_slice_arg(_a: &[u32]) {}

0 commit comments

Comments
 (0)