[llvm] 7a70e6e - [XCOFF] ignore the cold attribute.

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 22:14:38 PDT 2022


Author: esmeyi
Date: 2022-08-11T01:13:05-04:00
New Revision: 7a70e6e224cdbbd02cf6a7a7d8ff69950faaa35f

URL: https://github.com/llvm/llvm-project/commit/7a70e6e224cdbbd02cf6a7a7d8ff69950faaa35f
DIFF: https://github.com/llvm/llvm-project/commit/7a70e6e224cdbbd02cf6a7a7d8ff69950faaa35f.diff

LOG: [XCOFF] ignore the cold attribute.

Summary: AIX XCOFF doesn't support the cold feature.
    While it shouldn't be a function error when XCOFF catching the cold attribute.
    As with the behavior of other formats, we just ignore the attribute for now.

Reviewed By: DiggerLin

Differential Revision: https://reviews.llvm.org/D131473

Added: 
    llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll

Modified: 
    llvm/lib/MC/MCXCOFFStreamer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCXCOFFStreamer.cpp b/llvm/lib/MC/MCXCOFFStreamer.cpp
index a4a42279d6e23..7b4f6496e2a28 100644
--- a/llvm/lib/MC/MCXCOFFStreamer.cpp
+++ b/llvm/lib/MC/MCXCOFFStreamer.cpp
@@ -37,6 +37,10 @@ bool MCXCOFFStreamer::emitSymbolAttribute(MCSymbol *Sym,
   getAssembler().registerSymbol(*Symbol);
 
   switch (Attribute) {
+  // XCOFF doesn't support the cold feature.
+  case MCSA_Cold:
+    return false;
+
   case MCSA_Global:
   case MCSA_Extern:
     Symbol->setStorageClass(XCOFF::C_EXT);

diff  --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll
new file mode 100644
index 0000000000000..531be9d07dd49
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll
@@ -0,0 +1,15 @@
+; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj -o %t.o < %s
+; RUN: llvm-objdump --syms %t.o | FileCheck %s
+
+; CHECK:      SYMBOL TABLE:
+; CHECK-NEXT: 0000000000000000      df *DEBUG* 0000000000000000 <stdin>
+; CHECK-NEXT: 0000000000000000 l       .text   000000000000001e .text
+; CHECK-NEXT: 0000000000000000 g     F .text (csect: .text)  0000000000000000 .cold_fun
+; CHECK-NEXT: 0000000000000020 g     O .data   0000000000000018 cold_fun
+
+define dso_local void @cold_fun() #1 {
+entry:
+  ret void
+}
+
+attributes #1 = { cold }


        


More information about the llvm-commits mailing list