From f9b3fe9b58c5f2a681172c6dc46c8fbc06cab094 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Thu, 28 Mar 2024 20:50:19 +0100 Subject: [PATCH 1/3] Adapt lit-test codegen/cmpxchg.d to LLVM 18 In the optimized IR, there are new unused labels, *and* the anonymous values in the 2 checked functions start with `%0`, not with `%1`... --- tests/codegen/cmpxchg.d | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/codegen/cmpxchg.d b/tests/codegen/cmpxchg.d index e2ff2ec356e..ce51270db81 100644 --- a/tests/codegen/cmpxchg.d +++ b/tests/codegen/cmpxchg.d @@ -6,9 +6,10 @@ import core.atomic; bool foo(int cmp) { static shared int g; - // CHECK-NEXT: %1 = cmpxchg {{i32\*|ptr}} - // CHECK-NEXT: %2 = extractvalue { i32, i1 } %1, 1 - // CHECK-NEXT: ret i1 %2 + // CHECK-NOT: ret + // CHECK: [[FOO1:%[0-9]]] = cmpxchg {{i32\*|ptr}} + // CHECK-NEXT: [[FOO2:%[0-9]]] = extractvalue { i32, i1 } [[FOO1]], 1 + // CHECK-NEXT: ret i1 [[FOO2]] return cas(&g, cmp, 456); } @@ -16,11 +17,12 @@ bool foo(int cmp) double bar(double cmp) { static shared double g; - // CHECK-NEXT: %1 = bitcast double %cmp_arg to i64 - // CHECK-NEXT: %2 = cmpxchg weak {{i64\*|ptr}} + // CHECK-NOT: ret + // CHECK: [[BAR1:%[0-9]]] = bitcast double %cmp_arg to i64 + // CHECK-NEXT: [[BAR2:%[0-9]]] = cmpxchg weak {{i64\*|ptr}} casWeak(&g, &cmp, 456.0); - // CHECK-NEXT: %3 = extractvalue { i64, i1 } %2, 0 - // CHECK-NEXT: %4 = bitcast i64 %3 to double - // CHECK-NEXT: ret double %4 + // CHECK-NEXT: [[BAR3:%[0-9]]] = extractvalue { i64, i1 } [[BAR2]], 0 + // CHECK-NEXT: [[BAR4:%[0-9]]] = bitcast i64 [[BAR3]] to double + // CHECK-NEXT: ret double [[BAR4]] return cmp; } From 32f67c5b62bd38fab4c3a4651d1d27c169ca6056 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Fri, 29 Mar 2024 15:25:04 +0100 Subject: [PATCH 2/3] druntime: Fix ldc.profile.ProfileData definition with LLVM 18 Fixes lit-test `PGO/profile_rt_calls.d`. --- runtime/druntime/src/ldc/profile.di | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/druntime/src/ldc/profile.di b/runtime/druntime/src/ldc/profile.di index 56f494a9c09..57de7baf9d8 100644 --- a/runtime/druntime/src/ldc/profile.di +++ b/runtime/druntime/src/ldc/profile.di @@ -49,10 +49,14 @@ extern(C++) struct ProfileData { { ulong* Counters; } + static if (LLVM_version >= 1800) + void* BitmapPtr; void* FunctionPointer; void* Values; uint NumCounters; ushort NumValueSites; + static if (LLVM_version >= 1800) + uint NumBitmapBytes; } // Symbols provided by profile-rt lib From 617e090cbedb9d1766e3c5cfbaba60d070f5ee22 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Fri, 29 Mar 2024 15:43:44 +0100 Subject: [PATCH 3/3] Hide some new LLVM 18 CLI options --- driver/cl_options.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/driver/cl_options.cpp b/driver/cl_options.cpp index 96c67d2f138..4cec62a46ba 100644 --- a/driver/cl_options.cpp +++ b/driver/cl_options.cpp @@ -811,15 +811,15 @@ void hideLLVMOptions() { "amdgpu-dump-hsa-metadata", "amdgpu-enable-flat-scratch", "amdgpu-enable-global-sgpr-addr", "amdgpu-enable-merge-m0", "amdgpu-enable-power-sched", "amdgpu-igrouplp", - "amdgpu-promote-alloca-to-vector-limit", + "amdgpu-kernarg-preload-count", "amdgpu-promote-alloca-to-vector-limit", "amdgpu-reserve-vgpr-for-sgpr-spill", "amdgpu-sdwa-peephole", "amdgpu-use-aa-in-codegen", "amdgpu-verify-hsa-metadata", "amdgpu-vgpr-index-mode", "arm-add-build-attributes", "arm-implicit-it", "asm-instrumentation", "asm-show-inst", "atomic-counter-update-promoted", "atomic-first-counter", "basic-block-sections", - "basicblock-sections", "bounds-checking-single-trap", "bpf-stack-size", - "cfg-hide-cold-paths", + "basicblock-sections", "bounds-checking-single-trap", + "bounds-checking-unique-traps", "bpf-stack-size", "cfg-hide-cold-paths", "cfg-hide-deoptimize-paths", "cfg-hide-unreachable-paths", "code-model", "cost-kind", "cppfname", "cppfor", "cppgen", "cvp-dont-add-nowrap-flags", @@ -847,10 +847,11 @@ void hideLLVMOptions() { "enable-no-nans-fp-math", "enable-no-signed-zeros-fp-math", "enable-no-trapping-fp-math", "enable-objc-arc-annotations", "enable-objc-arc-opts", "enable-pie", "enable-scoped-noalias", - "enable-split-backedge-in-load-pre", - "enable-tbaa", "enable-unsafe-fp-math", "exception-model", - "exhaustive-register-search", "expensive-combines", + "enable-split-backedge-in-load-pre", "enable-split-loopiv-heuristic", + "enable-tbaa", "enable-tlsdesc", "enable-unsafe-fp-math", + "exception-model", "exhaustive-register-search", "expensive-combines", "experimental-debug-variable-locations", + "experimental-debuginfo-iterators", "fatal-assembler-warnings", "filter-print-funcs", "force-dwarf-frame-section", "force-opaque-pointers", "force-tail-folding-style", @@ -867,8 +868,8 @@ void hideLLVMOptions() { "instcombine-negator-max-depth", "instcombine-unsafe-select-transform", "instrprof-atomic-counter-update-all", "internalize-public-api-file", "internalize-public-api-list", "iterative-counter-promotion", - "join-liveintervals", "jump-table-type", "limit-float-precision", - "lower-global-dtors-via-cxa-atexit", + "join-liveintervals", "jump-table-type", "large-data-threshold", + "limit-float-precision", "lower-global-dtors-via-cxa-atexit", "lto-embed-bitcode", "matrix-default-layout", "matrix-print-after-transpose-opt", "matrix-propagate-shape", "max-counter-promotions", "max-counter-promotions-per-loop", @@ -881,20 +882,21 @@ void hideLLVMOptions() { "mwarn-noncontigious-register", "mwarn-sign-mismatch", "mxcoff-roptr", "no-discriminators", "no-integrated-as", "no-type-check", "no-xray-index", "nozero-initialized-in-bss", "nvptx-sched4reg", - "objc-arc-annotation-target-identifier", "opaque-pointers", + "objc-arc-annotation-target-identifier", + "object-size-offset-visitor-max-visit-instructions", "opaque-pointers", "pgo-block-coverage", "pgo-temporal-instrumentation", "pgo-view-block-coverage-graph", "pie-copy-relocations", "poison-checking-function-local", "polly-dump-after", "polly-dump-after-file", "polly-dump-before", "polly-dump-before-file", "pre-RA-sched", "print-after-all", "print-before-all", "print-machineinstrs", "print-module-scope", - "print-pipeline-passes", + "print-pipeline-passes", "profile-correlate", "profile-estimator-loop-weight", "profile-estimator-loop-weight", "profile-file", "profile-info-file", "profile-verifier-noassert", "pseudo-probe-for-profiling", "r600-ir-structurize", "rdf-dump", "rdf-limit", "recip", "regalloc", "relax-elf-relocations", "remarks-section", "rewrite-map-file", - "riscv-add-build-attributes", "rng-seed", + "riscv-add-build-attributes", "riscv-use-aa", "rng-seed", "runtime-counter-relocation", "safepoint-ir-verifier-print-only", "sample-profile-check-record-coverage", "sample-profile-check-sample-coverage",