[PATCH] D92493: [IR] Add hot to function attributes and use hot/cold attribute in function section prefix/suffix

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 10:19:08 PST 2020


MaskRay added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1747
     }
-
+    if (D->hasAttr<HotAttr>()) {
+      B.addAttribute(llvm::Attribute::Hot);
----------------
Omit braces

https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements


================
Comment at: clang/test/CodeGen/attributes.c:66
 
+// CHECK: define void @t82() [[HOTDEF:#[0-9]+]] {
+void t81(void) __attribute__((hot));
----------------
Nit: use `[[#HOTDEF:]]` (which is shorthand for `[[#%u,HOTDEF:]]`


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

https://reviews.llvm.org/D92493



More information about the llvm-commits mailing list