[all-commits] [llvm/llvm-project] 121b22: AddGlobalAnnotations for function with or without ...
Chris B via All-commits
all-commits at lists.llvm.org
Mon Oct 11 12:50:57 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 121b2252de0eed68f2ddf5f09e924a6c35423d47
https://github.com/llvm/llvm-project/commit/121b2252de0eed68f2ddf5f09e924a6c35423d47
Author: Chris Bieneman <chris.bieneman at me.com>
Date: 2021-10-11 (Mon, 11 Oct 2021)
Changed paths:
M clang/lib/CodeGen/CodeGenModule.cpp
M clang/test/CodeGen/annotations-global.c
M clang/test/CodeGenCXX/attr-annotate.cpp
Log Message:
-----------
AddGlobalAnnotations for function with or without function body.
When AnnotateAttr is on a function, AddGlobalAnnotations is only called
in CodeGenModule::EmitGlobalFunctionDefinition which means AnnotateAttr
on function declaration without function body will be ignored.
The patch will move AddGlobalAnnotations to
CodeGenModule::SetFunctionAttributes, so with or without function body,
the AnnotateAttr will get code gen for a function.
It'll help case when AnnotateAttr is on external function, and the
AnnotateAttr will be consumed in IR level.
For example, a pass to collect num of uses for functions with
__attribute((annotate("count_use"))) after optimizations,
As long as there's __attribute((annotate("count_use"))), function with
or without function body should be counted.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D111109
Patch by: python3kgae (Xiang Li)
More information about the All-commits
mailing list