bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/18414] New: TOC optimization


From: hfinkel at anl dot gov
Subject: [Bug ld/18414] New: TOC optimization
Date: Wed, 13 May 2015 23:08:32 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=18414

            Bug ID: 18414
           Summary: TOC optimization
           Product: binutils
           Version: 2.25
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hfinkel at anl dot gov
  Target Milestone: ---

When TOC optimization is enabled, on a (big-endian) POWER7 system, ld will
happily optimize this:

.Ltmp526:
        addis 3, 2, address@hidden@ha
.Ltmp1628:
        std 2, 40(1)
        ld 5, 0(27)
        ld 2, 8(27)
        ld 11, 16(27)
        ld 3, address@hidden@l(3)
        rldicl 4, 4, 0, 32
        mtctr 5
        bctrl
        ld 2, 40(1)


to this:

   0x00000000010101ac <+8924>:  nop
   0x00000000010101b0 <+8928>:  std     r2,40(r1)
   0x00000000010101b4 <+8932>:  ld      r5,0(r27)
   0x00000000010101b8 <+8936>:  ld      r2,8(r27)
   0x00000000010101bc <+8940>:  ld      r11,16(r27)
   0x00000000010101c0 <+8944>:  ld      r3,-32472(r2)
   0x00000000010101c4 <+8948>:  clrldi  r4,r4,32
   0x00000000010101c8 <+8952>:  mtctr   r5
   0x00000000010101cc <+8956>:  bctrl
=> 0x00000000010101d0 <+8960>:  ld      r2,40(r1)

note that the read of r2 (originally in the addis instruction) has been moved
to the ld after the ld which writes to r2. The addis is made into a nop.
Unfortunately, this is incorrect in the case where the r2 value loaded from the
function descriptor does not match the old r2 value.

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]