[PATCH] D127835: [SCEV] recognize llvm.annotation intrinsic
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 30 20:06:48 PDT 2022
shchenz updated this revision to Diff 441579.
shchenz marked an inline comment as done.
shchenz added a comment.
address @Meinersbur comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127835/new/
https://reviews.llvm.org/D127835
Files:
llvm/docs/LangRef.rst
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/annotation-intrinsics.ll
Index: llvm/test/Analysis/ScalarEvolution/annotation-intrinsics.ll
===================================================================
--- llvm/test/Analysis/ScalarEvolution/annotation-intrinsics.ll
+++ llvm/test/Analysis/ScalarEvolution/annotation-intrinsics.ll
@@ -8,7 +8,7 @@
; CHECK-LABEL: 'annotation'
; CHECK-NEXT: Classifying expressions for: @annotation
; CHECK-NEXT: %1 = tail call i64 @llvm.annotation.i64(i64 %x, i8* null, i8* null, i32 0)
-; CHECK-NEXT: --> %1 U: full-set S: full-set
+; CHECK-NEXT: --> %x U: full-set S: full-set
; CHECK-NEXT: Determining loop execution counts for: @annotation
;
%1 = tail call i64 @llvm.annotation.i64(i64 %x, i8* null, i8* null, i32 0)
@@ -19,7 +19,7 @@
; CHECK-LABEL: 'ptr_annotation'
; CHECK-NEXT: Classifying expressions for: @ptr_annotation
; CHECK-NEXT: %1 = call i8* @llvm.ptr.annotation.p0i8(i8* %x, i8* null, i8* null, i32 0, i8* null)
-; CHECK-NEXT: --> %1 U: full-set S: full-set
+; CHECK-NEXT: --> %x U: full-set S: full-set
; CHECK-NEXT: Determining loop execution counts for: @ptr_annotation
;
%1 = call i8* @llvm.ptr.annotation.p0i8(i8* %x, i8* null, i8* null, i32 0, i8* null)
Index: llvm/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -7624,8 +7624,10 @@
return getAddExpr(ClampedX, Y, SCEV::FlagNUW);
}
case Intrinsic::start_loop_iterations:
- // A start_loop_iterations is just equivalent to the first operand for
- // SCEV purposes.
+ case Intrinsic::annotation:
+ case Intrinsic::ptr_annotation:
+ // A start_loop_iterations or llvm.annotation or llvm.prt.annotation is
+ // just eqivalent to the first operand for SCEV purposes.
return getSCEV(II->getArgOperand(0));
default:
break;
Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -23575,8 +23575,10 @@
This intrinsic allows annotation of a pointer to an integer with arbitrary
strings. This can be useful for special purpose optimizations that want to look
-for these annotations. These have no other defined use; they are ignored by code
-generation and optimization.
+for these annotations. These have no other defined use; transformations preserve
+annotations on a best-effort basis but are allowed to replace them with their
+first argument without breaking semantics and are completely dropped during
+instruction selection.
'``llvm.annotation.*``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23614,7 +23616,9 @@
This intrinsic allows annotations to be put on arbitrary expressions
with arbitrary strings. This can be useful for special purpose
optimizations that want to look for these annotations. These have no
-other defined use; they are ignored by code generation and optimization.
+other defined use; transformations preserve annotations on a best-effort basis
+but are allowed to replace them with their first argument without breaking
+semantics and are completely dropped during instruction selection.
'``llvm.codeview.annotation``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127835.441579.patch
Type: text/x-patch
Size: 3309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220701/8528aa65/attachment.bin>
More information about the llvm-commits
mailing list