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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 05:42:11 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
----------------
arsenm wrote:

The memcpy case is one we eventually need to support to get rid of constant address space 

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


More information about the llvm-commits mailing list