[PATCH] D130933: Add docs for function attributes hot/cold

2022-08-01 Thread Ofek Shilon via Phabricator via cfe-commits
OfekShilon created this revision.
OfekShilon added reviewers: xur, davidxl.
Herald added a reviewer: aaron.ballman.
Herald added a project: All.
OfekShilon requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Following this , add docs for the hot/cold 
function attributes


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130933

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td


Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -5241,6 +5241,22 @@
 }];
 }
 
+def HotFunctionEntryDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((hot))`` marks a function as hot, as a manual alternative to 
PGO hotness data. 
+In case PGO data is available too user annotated ``__attribute__((hot))`` 
overwrites profile count based hotness (unlike ``__attribute__((cold))``).
+}];
+}
+
+def ColdFunctionEntryDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((cold))`` marks a function as cold, as a manual alternative to 
PGO hotness data. 
+In case PGO data is available too profile count based hotness overwrites user 
annotated ``__attribute__((cold))`` (unlike ``__attribute__((hot))``).
+}];
+}
+
 def TransparentUnionDocs : Documentation {
   let Category = DocCatDecl;
   let Content = [{
Index: clang/include/clang/Basic/Attr.td
===
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1073,8 +1073,7 @@
 def Cold : InheritableAttr {
   let Spellings = [GCC<"cold">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
-  let SimpleHandler = 1;
+  let Documentation = [ColdFunctionEntryDocs];
 }
 
 def Common : InheritableAttr {
@@ -1519,8 +1518,7 @@
 def Hot : InheritableAttr {
   let Spellings = [GCC<"hot">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
-  let SimpleHandler = 1;
+  let Documentation = [HotFunctionEntryDocs];
 }
 def : MutualExclusions<[Hot, Cold]>;
 


Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -5241,6 +5241,22 @@
 }];
 }
 
+def HotFunctionEntryDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((hot))`` marks a function as hot, as a manual alternative to PGO hotness data. 
+In case PGO data is available too user annotated ``__attribute__((hot))`` overwrites profile count based hotness (unlike ``__attribute__((cold))``).
+}];
+}
+
+def ColdFunctionEntryDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((cold))`` marks a function as cold, as a manual alternative to PGO hotness data. 
+In case PGO data is available too profile count based hotness overwrites user annotated ``__attribute__((cold))`` (unlike ``__attribute__((hot))``).
+}];
+}
+
 def TransparentUnionDocs : Documentation {
   let Category = DocCatDecl;
   let Content = [{
Index: clang/include/clang/Basic/Attr.td
===
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1073,8 +1073,7 @@
 def Cold : InheritableAttr {
   let Spellings = [GCC<"cold">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
-  let SimpleHandler = 1;
+  let Documentation = [ColdFunctionEntryDocs];
 }
 
 def Common : InheritableAttr {
@@ -1519,8 +1518,7 @@
 def Hot : InheritableAttr {
   let Spellings = [GCC<"hot">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
-  let SimpleHandler = 1;
+  let Documentation = [HotFunctionEntryDocs];
 }
 def : MutualExclusions<[Hot, Cold]>;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D130933: Add docs for function attributes hot/cold

2022-08-09 Thread Ofek Shilon via Phabricator via cfe-commits
OfekShilon updated this revision to Diff 451237.
OfekShilon added a comment.

Addressed Aaron's comments (thanks!). Hope I got the update-diff procedure 
right.
I don't have commit permissions, would appreciate if someone could push this.


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

https://reviews.llvm.org/D130933

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td


Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -5245,7 +5245,7 @@
   let Category = DocCatFunction;
   let Content = [{
 ``__attribute__((hot))`` marks a function as hot, as a manual alternative to 
PGO hotness data. 
-In case PGO data is available too user annotated ``__attribute__((hot))`` 
overwrites profile count based hotness (unlike ``__attribute__((cold))``).
+If PGO data is available, the annotation ``__attribute__((hot))`` overrides 
the profile count based hotness (unlike ``__attribute__((cold))``).
 }];
 }
 
@@ -5253,7 +5253,7 @@
   let Category = DocCatFunction;
   let Content = [{
 ``__attribute__((cold))`` marks a function as cold, as a manual alternative to 
PGO hotness data. 
-In case PGO data is available too profile count based hotness overwrites user 
annotated ``__attribute__((cold))`` (unlike ``__attribute__((hot))``).
+If PGO data is available, the profile count based hotness overrides the 
``__attribute__((cold))`` annotation (unlike ``__attribute__((hot))``).
 }];
 }
 
Index: clang/include/clang/Basic/Attr.td
===
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1074,6 +1074,7 @@
   let Spellings = [GCC<"cold">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [ColdFunctionEntryDocs];
+  let SimpleHandler = 1;
 }
 
 def Common : InheritableAttr {
@@ -1519,6 +1520,7 @@
   let Spellings = [GCC<"hot">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [HotFunctionEntryDocs];
+  let SimpleHandler = 1;
 }
 def : MutualExclusions<[Hot, Cold]>;
 


Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -5245,7 +5245,7 @@
   let Category = DocCatFunction;
   let Content = [{
 ``__attribute__((hot))`` marks a function as hot, as a manual alternative to PGO hotness data. 
-In case PGO data is available too user annotated ``__attribute__((hot))`` overwrites profile count based hotness (unlike ``__attribute__((cold))``).
+If PGO data is available, the annotation ``__attribute__((hot))`` overrides the profile count based hotness (unlike ``__attribute__((cold))``).
 }];
 }
 
@@ -5253,7 +5253,7 @@
   let Category = DocCatFunction;
   let Content = [{
 ``__attribute__((cold))`` marks a function as cold, as a manual alternative to PGO hotness data. 
-In case PGO data is available too profile count based hotness overwrites user annotated ``__attribute__((cold))`` (unlike ``__attribute__((hot))``).
+If PGO data is available, the profile count based hotness overrides the ``__attribute__((cold))`` annotation (unlike ``__attribute__((hot))``).
 }];
 }
 
Index: clang/include/clang/Basic/Attr.td
===
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1074,6 +1074,7 @@
   let Spellings = [GCC<"cold">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [ColdFunctionEntryDocs];
+  let SimpleHandler = 1;
 }
 
 def Common : InheritableAttr {
@@ -1519,6 +1520,7 @@
   let Spellings = [GCC<"hot">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [HotFunctionEntryDocs];
+  let SimpleHandler = 1;
 }
 def : MutualExclusions<[Hot, Cold]>;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D130933: Add docs for function attributes hot/cold

2022-08-09 Thread Ofek Shilon via Phabricator via cfe-commits
OfekShilon added a comment.

> It looks like something might have gone wrong because the diff looks like 
> it's now a diff against something other than the main branch (it looks like 
> it's adding the SimpleHandler lines in Attr.td, but those lines already exist 
> in main).

Sorry about that, but not sure where is the problem. I'm seeing (in this page) 
that Diff 451237 does add SimpleHandler, and can't see 'main' or any other 
branches displayed. The uploaded diff was generated by running `git diff > 
doc.patch` on a repo with the changes uncommitted. Was that a mistake? What is 
the right way?


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

https://reviews.llvm.org/D130933

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


[PATCH] D130933: Add docs for function attributes hot/cold

2022-08-10 Thread Ofek Shilon via Phabricator via cfe-commits
OfekShilon updated this revision to Diff 451535.
OfekShilon added a comment.

My apologies for the mess, hopefully the diff I just uploaded includes all the 
right fixes.


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

https://reviews.llvm.org/D130933

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td


Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -5241,6 +5241,21 @@
 }];
 }
 
+def HotFunctionEntryDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((hot))`` marks a function as hot, as a manual alternative to 
PGO hotness data.
+If PGO data is available, the annotation ``__attribute__((hot))`` overrides 
the profile count based hotness (unlike ``__attribute__((cold))``).
+}];
+}
+
+def ColdFunctionEntryDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((cold))`` marks a function as cold, as a manual alternative to 
PGO hotness data.
+If PGO data is available, the profile count based hotness overrides the 
``__attribute__((cold))`` annotation (unlike ``__attribute__((hot))``).
+}];
+}
 def TransparentUnionDocs : Documentation {
   let Category = DocCatDecl;
   let Content = [{
Index: clang/include/clang/Basic/Attr.td
===
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1073,7 +1073,7 @@
 def Cold : InheritableAttr {
   let Spellings = [GCC<"cold">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [ColdFunctionEntryDocs];
   let SimpleHandler = 1;
 }
 
@@ -1519,7 +1519,7 @@
 def Hot : InheritableAttr {
   let Spellings = [GCC<"hot">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [HotFunctionEntryDocs];
   let SimpleHandler = 1;
 }
 def : MutualExclusions<[Hot, Cold]>;


Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -5241,6 +5241,21 @@
 }];
 }
 
+def HotFunctionEntryDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((hot))`` marks a function as hot, as a manual alternative to PGO hotness data.
+If PGO data is available, the annotation ``__attribute__((hot))`` overrides the profile count based hotness (unlike ``__attribute__((cold))``).
+}];
+}
+
+def ColdFunctionEntryDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((cold))`` marks a function as cold, as a manual alternative to PGO hotness data.
+If PGO data is available, the profile count based hotness overrides the ``__attribute__((cold))`` annotation (unlike ``__attribute__((hot))``).
+}];
+}
 def TransparentUnionDocs : Documentation {
   let Category = DocCatDecl;
   let Content = [{
Index: clang/include/clang/Basic/Attr.td
===
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1073,7 +1073,7 @@
 def Cold : InheritableAttr {
   let Spellings = [GCC<"cold">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [ColdFunctionEntryDocs];
   let SimpleHandler = 1;
 }
 
@@ -1519,7 +1519,7 @@
 def Hot : InheritableAttr {
   let Spellings = [GCC<"hot">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [HotFunctionEntryDocs];
   let SimpleHandler = 1;
 }
 def : MutualExclusions<[Hot, Cold]>;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D130933: Add docs for function attributes hot/cold

2022-08-10 Thread Ofek Shilon via Phabricator via cfe-commits
OfekShilon added a comment.

@aaron.ballman   'Ofek Shilon', ofekshi...@gmail.com is fine.
Thanks!


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

https://reviews.llvm.org/D130933

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


[PATCH] D136515: [builtins] Add __builtin_assume_separate_storage.

2023-04-27 Thread Ofek Shilon via Phabricator via cfe-commits
OfekShilon added subscribers: kosarev, OfekShilon.
OfekShilon added inline comments.



Comment at: clang/docs/LanguageExtensions.rst:2393
+particular object (so for example, it's never correct to call this function
+passing the addresses of fields in the same struct, elements of the same array,
+etc.).

bruno wrote:
> davidtgoldblatt wrote:
> > bruno wrote:
> > > Not necessarily a blocker, but it seems like some of these things you 
> > > mention can actually be caught by diagnostics without too much effort? 
> > > Any plans to add them?
> > I hadn't planned to (at least in the short term). Practically I expect uses 
> > of this to be mostly backed out from looking at bad assembly (this is the 
> > way I've been using it so far in experimentation). You wouldn't generally 
> > expect people to want to try to express "these two struct fields don't 
> > alias" and so on because alias analysis can already handle those cases 
> > fairly well.
> > 
> > My inclination would be to wait on the diagnostics until we see if it's a 
> > real problem, but I'm not strongly opposed if you'd really like them in v1. 
> > (Although in that case I'll probably bug you for some help with where / how 
> > to put the diagnostics).
> > My inclination would be to wait on the diagnostics until we see if it's a 
> > real problem
> 
> Sounds fair! Feel free to bug me when/if you decide to explore that route.
+2c: as of today tbaa *doesn't* handle well aliasing of two struct fields. 
There was some work to mitigate it by @kosarev 
(https://reviews.llvm.org/D41539) but it is still hidden behind a 
`-new-struct-path-tbaa` switch.   Example: https://godbolt.org/z/xPMzfea8W


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136515

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