[PATCH] D138722: Overload all llvm.annotation intrinsics for globals argument

2022-12-07 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added inline comments.



Comment at: clang/test/CodeGen/annotations-field.c:5
 
-// CHECK: private unnamed_addr constant [8 x i8] c"v_ann_{{.}}\00", section 
"llvm.metadata"
-// CHECK: private unnamed_addr constant [8 x i8] c"v_ann_{{.}}\00", section 
"llvm.metadata"
+// CHECK: private unnamed_addr[[$CONST_AS]] constant [8 x i8] 
c"v_ann_{{.}}\00", section "llvm.metadata"
+// CHECK: private unnamed_addr[[$CONST_AS]] constant [8 x i8] 
c"v_ann_{{.}}\00", section "llvm.metadata"

All these CHECK lines aren't getting consulted?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138722/new/

https://reviews.llvm.org/D138722

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138722: Overload all llvm.annotation intrinsics for globals argument

2022-12-07 Thread Alexander Richardson via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
arichardson marked 2 inline comments as done.
Closed by commit rG9114ac67a986: Overload all llvm.annotation intrinsics for 
globals argument (authored by arichardson).

Changed prior to commit:
  https://reviews.llvm.org/D138722?vs=480900=480969#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138722/new/

https://reviews.llvm.org/D138722

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenTypeCache.h
  clang/test/CodeGen/annotations-field.c
  clang/test/CodeGen/annotations-global.c
  clang/test/CodeGen/annotations-loc.c
  clang/test/CodeGen/annotations-var.c
  clang/test/CodeGenCXX/attr-annotate.cpp
  clang/test/CodeGenCXX/attr-annotate2.cpp
  clang/test/CodeGenSYCL/field-annotate-addr-space.cpp
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/test/Analysis/CostModel/X86/free-intrinsics.ll
  llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll
  llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll
  llvm/test/Analysis/ScalarEvolution/annotation-intrinsics.ll
  llvm/test/Assembler/opaque-ptr-intrinsic-remangling.ll
  llvm/test/Bitcode/upgrade-annotation.ll
  llvm/test/Bitcode/upgrade-ptr-annotation.ll
  llvm/test/Bitcode/upgrade-var-annotation.ll
  llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
  llvm/test/Transforms/InstCombine/assume_inevitable.ll

Index: llvm/test/Transforms/InstCombine/assume_inevitable.ll
===
--- llvm/test/Transforms/InstCombine/assume_inevitable.ll
+++ llvm/test/Transforms/InstCombine/assume_inevitable.ll
@@ -10,11 +10,11 @@
 ; CHECK-NEXT:[[M:%.*]] = alloca i64, align 8
 ; CHECK-NEXT:[[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 32
 ; CHECK-NEXT:[[LOADRES:%.*]] = load i32, ptr [[B:%.*]], align 4
-; CHECK-NEXT:[[LOADRES2:%.*]] = call i32 @llvm.annotation.i32(i32 [[LOADRES]], ptr nonnull @.str, ptr nonnull @.str1, i32 2)
+; CHECK-NEXT:[[LOADRES2:%.*]] = call i32 @llvm.annotation.i32.p0(i32 [[LOADRES]], ptr nonnull @.str, ptr nonnull @.str1, i32 2)
 ; CHECK-NEXT:store i32 [[LOADRES2]], ptr [[A]], align 32
 ; CHECK-NEXT:[[DUMMY_EQ:%.*]] = icmp ugt i32 [[LOADRES]], 42
 ; CHECK-NEXT:tail call void @llvm.assume(i1 [[DUMMY_EQ]])
-; CHECK-NEXT:[[M_A:%.*]] = call ptr @llvm.ptr.annotation.p0(ptr nonnull [[M]], ptr nonnull @.str, ptr nonnull @.str1, i32 2, ptr null)
+; CHECK-NEXT:[[M_A:%.*]] = call ptr @llvm.ptr.annotation.p0.p0(ptr nonnull [[M]], ptr nonnull @.str, ptr nonnull @.str1, i32 2, ptr null)
 ; CHECK-NEXT:[[OBJSZ:%.*]] = call i64 @llvm.objectsize.i64.p0(ptr [[C:%.*]], i1 false, i1 false, i1 false)
 ; CHECK-NEXT:store i64 [[OBJSZ]], ptr [[M_A]], align 4
 ; CHECK-NEXT:[[PTRINT:%.*]] = ptrtoint ptr [[A]] to i64
Index: llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
===
--- llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
+++ llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
@@ -12,7 +12,7 @@
 ; CHECK-LABEL: @annotated(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TMP0:%.*]] = load i32, ptr [[C:%.*]], align 4
-; CHECK-NEXT:[[TMP1:%.*]] = call i32 @llvm.annotation.i32(i32 [[TMP0]], ptr undef, ptr undef, i32 undef)
+; CHECK-NEXT:[[TMP1:%.*]] = call i32 @llvm.annotation.i32.p0(i32 [[TMP0]], ptr undef, ptr undef, i32 undef)
 ; CHECK-NEXT:[[ADD:%.*]] = add nsw i32 [[TMP1]], [[TMP0]]
 ; CHECK-NEXT:ret i32 [[ADD]]
 ;
Index: llvm/test/Bitcode/upgrade-var-annotation.ll
===
--- llvm/test/Bitcode/upgrade-var-annotation.ll
+++ llvm/test/Bitcode/upgrade-var-annotation.ll
@@ -7,10 +7,10 @@
 define void @f(i8* %arg0, i8* %arg1, i8* %arg2, i32 %arg3) {
 ;CHECK: @f(i8* [[ARG0:%.*]], i8* [[ARG1:%.*]], i8* [[ARG2:%.*]], i32 [[ARG3:%.*]])
   call void @llvm.var.annotation(i8* %arg0, i8* %arg1, i8* %arg2, i32 %arg3)
-;CHECK:  call void @llvm.var.annotation(i8* [[ARG0]], i8* [[ARG1]], i8* [[ARG2]], i32 [[ARG3]], i8* null)
+;CHECK:  call void @llvm.var.annotation.p0i8.p0i8(i8* [[ARG0]], i8* [[ARG1]], i8* [[ARG2]], i32 [[ARG3]], i8* null)
   ret void
 }
 
 ; Function Attrs: nofree nosync nounwind willreturn
 declare void @llvm.var.annotation(i8*, i8*, i8*, i32)
-; CHECK: declare void @llvm.var.annotation(i8*, i8*, i8*, i32, i8*)
+; CHECK: declare void @llvm.var.annotation.p0i8.p0i8(i8*, i8*, i8*, i32, i8*)
Index: llvm/test/Bitcode/upgrade-ptr-annotation.ll
===
--- llvm/test/Bitcode/upgrade-ptr-annotation.ll
+++ llvm/test/Bitcode/upgrade-ptr-annotation.ll
@@ -10,17 +10,17 @@
 define void @f1(i8* %arg0, i8* %arg1, i8* %arg2, i32 %arg3) {
 ;CHECK: @f1(i8* 

[PATCH] D138722: Overload all llvm.annotation intrinsics for globals argument

2022-12-07 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson updated this revision to Diff 480900.
arichardson added a comment.

use opaque pointers in the new test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138722/new/

https://reviews.llvm.org/D138722

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenTypeCache.h
  clang/test/CodeGen/annotations-field.c
  clang/test/CodeGen/annotations-global.c
  clang/test/CodeGen/annotations-loc.c
  clang/test/CodeGen/annotations-var.c
  clang/test/CodeGenCXX/attr-annotate.cpp
  clang/test/CodeGenCXX/attr-annotate2.cpp
  clang/test/CodeGenSYCL/field-annotate-addr-space.cpp
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/test/Analysis/CostModel/X86/free-intrinsics.ll
  llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll
  llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll
  llvm/test/Analysis/ScalarEvolution/annotation-intrinsics.ll
  llvm/test/Assembler/opaque-ptr-intrinsic-remangling.ll
  llvm/test/Bitcode/upgrade-annotation.ll
  llvm/test/Bitcode/upgrade-annotation.ll.bc
  llvm/test/Bitcode/upgrade-ptr-annotation.ll
  llvm/test/Bitcode/upgrade-var-annotation.ll
  llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
  llvm/test/Transforms/InstCombine/assume_inevitable.ll

Index: llvm/test/Transforms/InstCombine/assume_inevitable.ll
===
--- llvm/test/Transforms/InstCombine/assume_inevitable.ll
+++ llvm/test/Transforms/InstCombine/assume_inevitable.ll
@@ -10,11 +10,11 @@
 ; CHECK-NEXT:[[M:%.*]] = alloca i64, align 8
 ; CHECK-NEXT:[[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 32
 ; CHECK-NEXT:[[LOADRES:%.*]] = load i32, ptr [[B:%.*]], align 4
-; CHECK-NEXT:[[LOADRES2:%.*]] = call i32 @llvm.annotation.i32(i32 [[LOADRES]], ptr nonnull @.str, ptr nonnull @.str1, i32 2)
+; CHECK-NEXT:[[LOADRES2:%.*]] = call i32 @llvm.annotation.i32.p0(i32 [[LOADRES]], ptr nonnull @.str, ptr nonnull @.str1, i32 2)
 ; CHECK-NEXT:store i32 [[LOADRES2]], ptr [[A]], align 32
 ; CHECK-NEXT:[[DUMMY_EQ:%.*]] = icmp ugt i32 [[LOADRES]], 42
 ; CHECK-NEXT:tail call void @llvm.assume(i1 [[DUMMY_EQ]])
-; CHECK-NEXT:[[M_A:%.*]] = call ptr @llvm.ptr.annotation.p0(ptr nonnull [[M]], ptr nonnull @.str, ptr nonnull @.str1, i32 2, ptr null)
+; CHECK-NEXT:[[M_A:%.*]] = call ptr @llvm.ptr.annotation.p0.p0(ptr nonnull [[M]], ptr nonnull @.str, ptr nonnull @.str1, i32 2, ptr null)
 ; CHECK-NEXT:[[OBJSZ:%.*]] = call i64 @llvm.objectsize.i64.p0(ptr [[C:%.*]], i1 false, i1 false, i1 false)
 ; CHECK-NEXT:store i64 [[OBJSZ]], ptr [[M_A]], align 4
 ; CHECK-NEXT:[[PTRINT:%.*]] = ptrtoint ptr [[A]] to i64
Index: llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
===
--- llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
+++ llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
@@ -12,7 +12,7 @@
 ; CHECK-LABEL: @annotated(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TMP0:%.*]] = load i32, ptr [[C:%.*]], align 4
-; CHECK-NEXT:[[TMP1:%.*]] = call i32 @llvm.annotation.i32(i32 [[TMP0]], ptr undef, ptr undef, i32 undef)
+; CHECK-NEXT:[[TMP1:%.*]] = call i32 @llvm.annotation.i32.p0(i32 [[TMP0]], ptr undef, ptr undef, i32 undef)
 ; CHECK-NEXT:[[ADD:%.*]] = add nsw i32 [[TMP1]], [[TMP0]]
 ; CHECK-NEXT:ret i32 [[ADD]]
 ;
Index: llvm/test/Bitcode/upgrade-var-annotation.ll
===
--- llvm/test/Bitcode/upgrade-var-annotation.ll
+++ llvm/test/Bitcode/upgrade-var-annotation.ll
@@ -1,15 +1,16 @@
 ; Test upgrade of var.annotation intrinsics.
 ;
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: llvm-dis < %s.bc | FileCheck %s
 
 
 define void @f(i8* %arg0, i8* %arg1, i8* %arg2, i32 %arg3) {
 ;CHECK: @f(i8* [[ARG0:%.*]], i8* [[ARG1:%.*]], i8* [[ARG2:%.*]], i32 [[ARG3:%.*]])
   call void @llvm.var.annotation(i8* %arg0, i8* %arg1, i8* %arg2, i32 %arg3)
-;CHECK:  call void @llvm.var.annotation(i8* [[ARG0]], i8* [[ARG1]], i8* [[ARG2]], i32 [[ARG3]], i8* null)
+;CHECK:  call void @llvm.var.annotation.p0i8.p0i8(i8* [[ARG0]], i8* [[ARG1]], i8* [[ARG2]], i32 [[ARG3]], i8* null)
   ret void
 }
 
 ; Function Attrs: nofree nosync nounwind willreturn
 declare void @llvm.var.annotation(i8*, i8*, i8*, i32)
-; CHECK: declare void @llvm.var.annotation(i8*, i8*, i8*, i32, i8*)
+; CHECK: declare void @llvm.var.annotation.p0i8.p0i8(i8*, i8*, i8*, i32, i8*)
Index: llvm/test/Bitcode/upgrade-ptr-annotation.ll
===
--- llvm/test/Bitcode/upgrade-ptr-annotation.ll
+++ llvm/test/Bitcode/upgrade-ptr-annotation.ll
@@ -1,5 +1,6 @@
 ; Test upgrade of ptr.annotation intrinsics.
 ;
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: llvm-dis < %s.bc | FileCheck %s
 
 ; Unused return values
@@ 

[PATCH] D138722: Overload all llvm.annotation intrinsics for globals argument

2022-12-06 Thread Nikita Popov via Phabricator via cfe-commits
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: llvm/test/Bitcode/upgrade-annotation.ll:14
+
+declare i32 @llvm.annotation.i32(i32, i8*, i8*, i32)
+; CHECK: declare i32 @llvm.annotation.i32.p0i8(i32, i8*, i8*, i32)

arsenm wrote:
> New tests should use opaque pointers. For autoupgrade we may want and need 
> both test copies
I think this is fine for now. We'll deal with this when we remove the typed 
pointer auto-detection from the bitcode reader, at which point all existing 
typed pointer bitcode will get upgraded to opaque pointer bitcode.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138722/new/

https://reviews.llvm.org/D138722

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138722: Overload all llvm.annotation intrinsics for globals argument

2022-12-02 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments.



Comment at: llvm/test/Bitcode/upgrade-annotation.ll:14
+
+declare i32 @llvm.annotation.i32(i32, i8*, i8*, i32)
+; CHECK: declare i32 @llvm.annotation.i32.p0i8(i32, i8*, i8*, i32)

New tests should use opaque pointers. For autoupgrade we may want and need both 
test copies


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138722/new/

https://reviews.llvm.org/D138722

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138722: Overload all llvm.annotation intrinsics for globals argument

2022-11-25 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson created this revision.
arichardson added reviewers: arsenm, bader, Tyker, nikic.
Herald added subscribers: jrtc27, hiraditya.
Herald added a project: All.
arichardson requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, jdoerfert, wdng.
Herald added projects: clang, LLVM.

The global constant arguments could be in a different address space
than the first argument, so we have to add another overloaded argument.
This patch was originally made for CHERI LLVM (where globals can be in
address space 200), but it also appears to be useful for in-tree targets
as can be seen from the test diffs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138722

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenTypeCache.h
  clang/test/CodeGen/annotations-field.c
  clang/test/CodeGen/annotations-global.c
  clang/test/CodeGen/annotations-loc.c
  clang/test/CodeGen/annotations-var.c
  clang/test/CodeGenCXX/attr-annotate.cpp
  clang/test/CodeGenCXX/attr-annotate2.cpp
  clang/test/CodeGenSYCL/field-annotate-addr-space.cpp
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/test/Analysis/CostModel/X86/free-intrinsics.ll
  llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll
  llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll
  llvm/test/Analysis/ScalarEvolution/annotation-intrinsics.ll
  llvm/test/Assembler/opaque-ptr-intrinsic-remangling.ll
  llvm/test/Bitcode/upgrade-annotation.ll
  llvm/test/Bitcode/upgrade-annotation.ll.bc
  llvm/test/Bitcode/upgrade-ptr-annotation.ll
  llvm/test/Bitcode/upgrade-var-annotation.ll
  llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
  llvm/test/Transforms/InstCombine/assume_inevitable.ll

Index: llvm/test/Transforms/InstCombine/assume_inevitable.ll
===
--- llvm/test/Transforms/InstCombine/assume_inevitable.ll
+++ llvm/test/Transforms/InstCombine/assume_inevitable.ll
@@ -10,11 +10,11 @@
 ; CHECK-NEXT:[[M:%.*]] = alloca i64, align 8
 ; CHECK-NEXT:[[TMP0:%.*]] = load i32, ptr [[A:%.*]], align 32
 ; CHECK-NEXT:[[LOADRES:%.*]] = load i32, ptr [[B:%.*]], align 4
-; CHECK-NEXT:[[LOADRES2:%.*]] = call i32 @llvm.annotation.i32(i32 [[LOADRES]], ptr nonnull @.str, ptr nonnull @.str1, i32 2)
+; CHECK-NEXT:[[LOADRES2:%.*]] = call i32 @llvm.annotation.i32.p0(i32 [[LOADRES]], ptr nonnull @.str, ptr nonnull @.str1, i32 2)
 ; CHECK-NEXT:store i32 [[LOADRES2]], ptr [[A]], align 32
 ; CHECK-NEXT:[[DUMMY_EQ:%.*]] = icmp ugt i32 [[LOADRES]], 42
 ; CHECK-NEXT:tail call void @llvm.assume(i1 [[DUMMY_EQ]])
-; CHECK-NEXT:[[M_A:%.*]] = call ptr @llvm.ptr.annotation.p0(ptr nonnull [[M]], ptr nonnull @.str, ptr nonnull @.str1, i32 2, ptr null)
+; CHECK-NEXT:[[M_A:%.*]] = call ptr @llvm.ptr.annotation.p0.p0(ptr nonnull [[M]], ptr nonnull @.str, ptr nonnull @.str1, i32 2, ptr null)
 ; CHECK-NEXT:[[OBJSZ:%.*]] = call i64 @llvm.objectsize.i64.p0(ptr [[C:%.*]], i1 false, i1 false, i1 false)
 ; CHECK-NEXT:store i64 [[OBJSZ]], ptr [[M_A]], align 4
 ; CHECK-NEXT:[[PTRINT:%.*]] = ptrtoint ptr [[A]] to i64
Index: llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
===
--- llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
+++ llvm/test/Transforms/InstCombine/annotation-intrinsic.ll
@@ -12,7 +12,7 @@
 ; CHECK-LABEL: @annotated(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[TMP0:%.*]] = load i32, ptr [[C:%.*]], align 4
-; CHECK-NEXT:[[TMP1:%.*]] = call i32 @llvm.annotation.i32(i32 [[TMP0]], ptr undef, ptr undef, i32 undef)
+; CHECK-NEXT:[[TMP1:%.*]] = call i32 @llvm.annotation.i32.p0(i32 [[TMP0]], ptr undef, ptr undef, i32 undef)
 ; CHECK-NEXT:[[ADD:%.*]] = add nsw i32 [[TMP1]], [[TMP0]]
 ; CHECK-NEXT:ret i32 [[ADD]]
 ;
Index: llvm/test/Bitcode/upgrade-var-annotation.ll
===
--- llvm/test/Bitcode/upgrade-var-annotation.ll
+++ llvm/test/Bitcode/upgrade-var-annotation.ll
@@ -1,15 +1,16 @@
 ; Test upgrade of var.annotation intrinsics.
 ;
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: llvm-dis < %s.bc | FileCheck %s
 
 
 define void @f(i8* %arg0, i8* %arg1, i8* %arg2, i32 %arg3) {
 ;CHECK: @f(i8* [[ARG0:%.*]], i8* [[ARG1:%.*]], i8* [[ARG2:%.*]], i32 [[ARG3:%.*]])
   call void @llvm.var.annotation(i8* %arg0, i8* %arg1, i8* %arg2, i32 %arg3)
-;CHECK:  call void @llvm.var.annotation(i8* [[ARG0]], i8* [[ARG1]], i8* [[ARG2]], i32 [[ARG3]], i8* null)
+;CHECK:  call void @llvm.var.annotation.p0i8.p0i8(i8* [[ARG0]], i8* [[ARG1]], i8* [[ARG2]], i32 [[ARG3]], i8* null)
   ret void
 }
 
 ; Function Attrs: nofree nosync nounwind willreturn
 declare void @llvm.var.annotation(i8*, i8*, i8*, i32)
-; CHECK: declare void @llvm.var.annotation(i8*, i8*, i8*, i32, i8*)
+; CHECK: declare