[clang] [clang] [Sema] Check argument range for prefetchi* intrinsics (PR #149745)

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 21 22:52:25 PDT 2025


================
@@ -14,3 +14,7 @@ void test_m_prefetch_it1(void *p) {
   // CHECK-LABEL: define{{.*}} void @test_m_prefetch_it1
   // CHECK: call void @llvm.prefetch.p0(ptr {{.*}}, i32 0, i32 2, i32 0)
 }
+
+void test_invalid_prefetchi(void* p) {
+  return __builtin_ia32_prefetchi(p, 1); // expected-error {{argument value 1 is outside the valid range [2, 3]}}
+}
----------------
phoebewang wrote:

The test needs to be in a seperate file.

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


More information about the cfe-commits mailing list