[Bug lto/91299] [10/11/12/13 Regression] LTO inlines a weak definition in presence of a non-weak definition from an ELF file

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 18 07:50:02 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91299

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
   Target Milestone|---                         |10.5
                 CC|                            |hubicka at gcc dot gnu.org
           Priority|P3                          |P2

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
1
a-weakdef.o 2
195 5359582ee909af0f PREEMPTED_REG foo
198 5359582ee909af0f PREVAILING_DEF main


Considering foo/0 with 3 size
 to be inlined into main/1 in unknown:-1
 Estimated badness is -inf, frequency 1.00.
    Badness calculation for main/1 -> foo/0
      size growth -1, time 0.000000 unspec 2.000000  big_speedup
      -inf: Growth -1 <= 0
      Adjusted by hints -inf
Updated mod-ref summary for main/1
  loads:
    Limits: 32 bases, 16 refs
  stores:
    Limits: 32 bases, 16 refs
optimized:  Inlined foo/0 into main/1 which now has time 2.000000 and size 3,
net change of -1.

but

foo/0 (foo) @0x7ffff65b5110
  Type: function definition analyzed
  Visibility: externally_visible preempted_reg external public weak
  References:
  Referring:
  Read from file: a-weakdef.o
  Availability: available
  Unit id: 1
  Function flags: count:1073741824 (estimated locally)
  Called by: main/1 (1073741824 (estimated locally),1.00 per call)
  Calls:

Honza?  This looks like a bug in handling of PREEMTED_REG?  Or do we apply
some sort of ODR argument here?  We also see 'foo' as 'const' at IPA time
(but at local time we see it's interposable and thus do not analyze it)


More information about the Gcc-bugs mailing list