about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-11-05 00:02:05 +0100
committerGitHub <noreply@github.com>2022-11-05 00:02:05 +0100
commitf6ca5aa19a567f6cb95a0c568cac148f8eb443fb (patch)
tree678187a31916d945048be88350736a4ecb158fcf /src/test/codegen
parentb1a47d2fd95e64227c07b428ba2e5170fac368f8 (diff)
parentc15cfc91c4567c4f079c2543dd395908f30f4911 (diff)
downloadrust-f6ca5aa19a567f6cb95a0c568cac148f8eb443fb.tar.gz
rust-f6ca5aa19a567f6cb95a0c568cac148f8eb443fb.zip
Rollup merge of #103977 - TimNN:memory-effects, r=nikic
LLVM 16: Switch to using MemoryEffects

This adapts the compiler to the changes required by https://github.com/llvm/llvm-project/commit/304f1d59ca41872c094def3aee0a8689df6aa398.

AFAICT, `WriteOnly` isn't used by the compiler, all `ReadNone` uses were migrated and the remaining use of `ReadOnly` is only for function parameters.

To simplify the FFI, this PR uses an enum to represent `MemoryEffects` across the FFI boundary, which then gets mapped to the matching static factory method when constructing the attribute.

Fixes #103961.

`@rustbot` label +llvm-main

r? `@nikic`
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/ffi-const.rs3
-rw-r--r--src/test/codegen/ffi-pure.rs3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/test/codegen/ffi-const.rs b/src/test/codegen/ffi-const.rs
index d9cfa5429b5..93720503480 100644
--- a/src/test/codegen/ffi-const.rs
+++ b/src/test/codegen/ffi-const.rs
@@ -7,6 +7,7 @@ pub fn bar() { unsafe { foo() } }
 extern "C" {
     // CHECK-LABEL: declare{{.*}}void @foo()
     // CHECK-SAME: [[ATTRS:#[0-9]+]]
-    // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}readnone{{.*}} }
+    // The attribute changed from `readnone` to `memory(none)` with LLVM 16.0.
+    // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readnone|memory\(none\)}}{{.*}} }
     #[ffi_const] pub fn foo();
 }
diff --git a/src/test/codegen/ffi-pure.rs b/src/test/codegen/ffi-pure.rs
index 5bdb2ee912a..2ed73581358 100644
--- a/src/test/codegen/ffi-pure.rs
+++ b/src/test/codegen/ffi-pure.rs
@@ -7,6 +7,7 @@ pub fn bar() { unsafe { foo() } }
 extern "C" {
     // CHECK-LABEL: declare{{.*}}void @foo()
     // CHECK-SAME: [[ATTRS:#[0-9]+]]
-    // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}readonly{{.*}} }
+    // The attribute changed from `readonly` to `memory(read)` with LLVM 16.0.
+    // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readonly|memory\(read\)}}{{.*}} }
     #[ffi_pure] pub fn foo();
 }