+2013-11-19 Sriraman Tallam <tmsriram@google.com>
+
+ * final.c (final_scan_insn): Emit a label for the split
+ cold function part. Label name is formed by suffixing
+ the original function name with "cold".
+
2013-11-19 David Malcolm <dmalcolm@redhat.com>
* basic-block.h (ENTRY_BLOCK_PTR_FOR_FUNCTION): Rename macro to...
targetm.asm_out.function_switched_text_sections (asm_out_file,
current_function_decl,
in_cold_section_p);
+ /* Emit a label for the split cold section. Form label name by
+ suffixing "cold" to the original function's name. */
+ if (in_cold_section_p)
+ {
+ tree cold_function_name
+ = clone_function_name (current_function_decl, "cold");
+ ASM_OUTPUT_LABEL (asm_out_file,
+ IDENTIFIER_POINTER (cold_function_name));
+ }
break;
case NOTE_INSN_BASIC_BLOCK:
+2013-11-19 Sriraman Tallam <tmsriram@google.com>
+
+ * gcc.dg/tree-prof/cold_partition_label.c: New testcase.
+
2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* gcc.target/powerpc/ppc64-abi-2.c (MAKE_SLOT): New macro to
--- /dev/null
+/* Test case to check if function foo gets split and the cold function
+ gets a label. */
+/* { dg-require-effective-target freorder } */
+/* { dg-options "-O2 -freorder-blocks-and-partition --save-temps" } */
+
+#define SIZE 10000
+
+const char *sarr[SIZE];
+const char *buf_hot;
+const char *buf_cold;
+
+__attribute__((noinline))
+void
+foo (int path)
+{
+ int i;
+ if (path)
+ {
+ for (i = 0; i < SIZE; i++)
+ sarr[i] = buf_hot;
+ }
+ else
+ {
+ for (i = 0; i < SIZE; i++)
+ sarr[i] = buf_cold;
+ }
+}
+
+int
+main (int argc, char *argv[])
+{
+ buf_hot = "hello";
+ buf_cold = "world";
+ foo (argc);
+ return 0;
+}