Hi,
Consider an lto multi-source test-case main.c and foo.c:
..
$ cat main.c
extern int foo (void);
int
main ()
{
return foo () + 1;
}
$ cat foo.c
int __attribute__((noinline, noclone))
foo (void)
{
return 2;
}
...
When compiling the test-case like this:
...
$ gcc main.c foo.c -O2 -flto -save-temps -flto-partition=1to1 -o a.out
...
the following happens:
1. main.s (containing gimple) is produced
(and then assembled to main.o)
2. foo.s (containing gimple) is produced
(and then assembled to main.o)
3. lto1 is called in wpa mode, generating a.out.ltrans0.o and
a.out.ltrans1.o
4. lto1 is called in ltrans mode, generating a.out.ltrans0.s
(which is then assembled to a.out.ltrans0.ltrans.o)
5. lto1 is called in ltrans mode, generating a.out.ltrans1.s
(which is then assembled to a.out.ltrans1.ltrans.o)
6. a.out is produced from a.out.ltrans0.ltrans.o and
a.out.ltrans1.ltrans.o
When adding dump flags "-fdump-tree-all -fdump-rtl-all -fdump-ipa-all"
to the command line, we get the following dump files.
For 1, we generate (ignoring the 000i.* and statistics dumps from here on):
- main.c.003t.original - main.c.050t.local-fnsummary2
- main.c.062i.targetclone - main.c.080i.pure-const
For 2, we generate:
- foo.c.003t.original - foo.c.050t.local-fnsummary2
- foo.c.062i.targetclone - foo.c.080i.pure-const
For 3, we generate:
- a.out.wpa.046t.profile_estimate
- a.out.wpa.071i.whole-program - a.out.wpa.084i.comdats
For 4, we generate:
- a.out.ltrans0.046t.profile_estimate
- a.out.ltrans0.075i.cp - a.out.ltrans0.087i.simdclone
- a.out.ltrans0.088t.fixup_cfg4 - a.out.ltrans0.232t.optimized
- a.out.ltrans0.234r.expand - a.out.ltrans0.317r.dfinish
For 5, we generate:
- a.out.ltrans1.046t.profile_estimate
- a.out.ltrans1.075i.cp - a.out.ltrans1.087i.simdclone
- a.out.ltrans1.088t.fixup_cfg4 - a.out.ltrans1.232t.optimized
- a.out.ltrans1.234r.expand - a.out.ltrans1.317r.dfinish
With the current set of dg-final commands scan-tree-dump, scan-rtl-dump
and scan-ipa-dump, we are able to scan dump files for 1 and 2, but not
for 3, 4 and 5.
This patch series adds:
- scan-wpa-ipa-dump, which allows us to scan the ipa dump files for 3
- scan-ltrans-tree-dump, which:
- allows us to scan the tree dump files for 4, and
- adds the option -flto-partition=one which forces wpa to combine
all functions into a single partition ltrans0 (so that we don't have
to worry about ltrans1 in 5).
Thanks,
- Tom