[llvm] [llvm] Support invariant.load on readonly intrinsics (PR #205916)

Krzysztof Drewniak via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 08:47:49 PDT 2026


================
@@ -0,0 +1,15 @@
+; RUN: not opt -passes=verify -S < %s 2>&1 | FileCheck %s
+
+declare i32 @readonly_call(ptr) memory(read)
+
+define void @invalid(ptr %dst, ptr %src) {
+; CHECK: invariant.load metadata is only for loads and readonly intrinsic calls
+  call i32 @readonly_call(ptr %src), !invariant.load !0
+
+; CHECK: invariant.load metadata is only for loads and readonly intrinsic calls
----------------
krzysz00 wrote:

What semantics for `!invariant.load` do you have in mind that would permit the existing optimizations (letting you slide this thing around) and would apply to memcpy()?

https://github.com/llvm/llvm-project/pull/205916


More information about the llvm-commits mailing list