[clang] [CIR] Add restrict→noalias on non-builtin pointer params (PR #191483)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 15:52:11 PDT 2026


================
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
+// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
+
+void user_func(int *__restrict p);
+
+void test_user(int *__restrict p) {
+  user_func(p);
+}
+
+// CIR: cir.func private @user_func(!cir.ptr<!s32i> {llvm.noalias, llvm.noundef})
+// CIR: cir.func {{.*}} @test_user(%arg0: !cir.ptr<!s32i> {llvm.noalias, llvm.noundef}
+// CIR:   cir.call @user_func(%{{.*}}) : (!cir.ptr<!s32i> {llvm.noalias, llvm.noundef}) -> ()
+
+// LLVM: define dso_local void @test_user(ptr noalias noundef %{{.*}})
+// LLVM:   call void @user_func(ptr noalias noundef %{{.*}})
+
+// OGCG: define dso_local void @test_user(ptr noalias noundef %{{.*}})
+// OGCG:   call void @user_func(ptr noundef %{{.*}})
----------------
andykaylor wrote:

Notice that this is missing `noalias`.

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


More information about the cfe-commits mailing list