diff mbox series

Enable autofdo bootstrap for lto/fortran

Message ID 20241031231916.3665910-1-ak@linux.intel.com
State New
Headers show
Series Enable autofdo bootstrap for lto/fortran | expand

Commit Message

Andi Kleen Oct. 31, 2024, 11:19 p.m. UTC
From: Andi Kleen <ak@gcc.gnu.org>

When autofdo bootstrap support was originally implemented there were
issues with the LTO bootstrap, that is why it wasn't enabled
for them. I retested this now and it works on x86_64-linux.

Fortran was also missing, not sure why. Also enabled now.

gcc/fortran/ChangeLog:

	* Make-lang.in: Enable autofdo.

gcc/lto/ChangeLog:

	* Make-lang.in: Enable autofdo.
---
 gcc/fortran/Make-lang.in | 13 +++++++++++--
 gcc/lto/Make-lang.in     | 14 +++++---------
 2 files changed, 16 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index 0be3c6b654b1..7295118185fd 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -69,6 +69,15 @@  F95_OBJS = $(F95_PARSER_OBJS) $(FORTRAN_TARGET_OBJS) \
 
 fortran_OBJS = $(F95_OBJS) fortran/gfortranspec.o
 
+ifeq ($(if $(wildcard ../stage_current),$(shell cat \
+  ../stage_current)),stageautofeedback)
+$(fortran_OBJS): CFLAGS += -fauto-profile=f95.fda
+$(fortran_OBJS): f95.fda
+endif
+
+f95.fda: create_fdas_for_lto1
+	$(PROFILE_MERGER) $(shell ls -ha f95_*.fda) --output_file f95.fda -gcov_version 2
+
 #
 # Define the names for selecting gfortran in LANGUAGES.
 fortran: f951$(exeext)
@@ -272,7 +281,7 @@  fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info
 fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext)
 
 $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \
-		installdirs
+		installdirs f95*.fda
 	-rm -f $@
 	-$(INSTALL_DATA) $< $@
 	-chmod a-x $@
@@ -293,7 +302,7 @@  fortran.uninstall:
 # We just have to delete files specific to us.
 
 fortran.mostlyclean:
-	-rm -f gfortran$(exeext) gfortran-cross$(exeext) f951$(exeext)
+	-rm -f gfortran$(exeext) gfortran-cross$(exeext) f951$(exeext) f95*.fda
 	-rm -f fortran/*.o
 
 fortran.clean:
diff --git a/gcc/lto/Make-lang.in b/gcc/lto/Make-lang.in
index b62ddcbe0dc9..4f9f21cdfc9e 100644
--- a/gcc/lto/Make-lang.in
+++ b/gcc/lto/Make-lang.in
@@ -29,15 +29,11 @@  lto_OBJS = $(LTO_OBJS)
 LTO_DUMP_OBJS = lto/lto-lang.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o lto/lto-dump.o lto/lto-common.o
 lto_dump_OBJS = $(LTO_DUMP_OBJS)
 
-# this is only useful in a LTO bootstrap, but this does not work right
-# now. Should reenable after this is fixed, but only when LTO bootstrap
-# is enabled.
-
-#ifeq ($(if $(wildcard ../stage_current),$(shell cat \
-#  ../stage_current)),stageautofeedback)
-#$(LTO_OBJS): CFLAGS += -fauto-profile=lto1.fda
-#$(LTO_OBJS): lto1.fda
-#endif
+ifeq ($(if $(wildcard ../stage_current),$(shell cat \
+  ../stage_current)),stageautofeedback)
+$(LTO_OBJS): CFLAGS += -fauto-profile=lto1.fda
+$(LTO_OBJS): lto1.fda
+endif
 
 # Rules