tmsriram marked an inline comment as done.
tmsriram added inline comments.

================
Comment at: clang/test/CodeGen/unique-internal-linkage-names.cpp:5
+// RUN: %clang_cc1 -triple x86_64 -x c++ -S -emit-llvm 
-funique-internal-linkage-names -o - < %s | FileCheck %s --check-prefix=UNIQUE
+
+static int glob;
----------------
wmi wrote:
> MaskRay wrote:
> > Might be worth adding a few other internal linkage names.
> > 
> > * an object in an unnamed namespace
> > * an extern "C" static function
> > * a function-local static variable
> > * `label: &&label`
> > 
> > Hope @mtrofin and @davidxl can clarify what internal names may benefit AFDO 
> > and we can add such internal names specifically.
> Only internal functions matter for AFDO. Other types of internal names are 
> irrelevant.
extern "C" static is not very useful as the name is not exposed outside the 
object file.  C++ compiler will still mangle the name. for eg:

a.cpp

extern "C" {
  static int bar() {
    return 0;
  }
}

int foo() {
  printf("%p\n", bar);
}

$ nm a.o 
0000000000000040 t _ZL3barv


Also, for label: &&label, it is not preserved in the symbol table as a .L<name> 
is used which is deleted by the assembler.  I can throw a asm("") directive but 
that will bypass the front-end.  Is there anyway to preserve this?  

I can add the rest of the cases.




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

https://reviews.llvm.org/D73307



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

Reply via email to