[llvm-bugs] [Bug 43572] New: Missed opportunity for loop unswitching - indirect calls (h264)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 5 02:57:06 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43572

            Bug ID: 43572
           Summary: Missed opportunity for loop unswitching - indirect
                    calls (h264)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

Seen in the hot code of h264.

PelYline_11 is a static global pointer to a function.

...
 for (pos = 0; pos < max_pos; pos++) {
    //if (pos > 1) abort();
    abs_y = offset_y + spiral_search_y[pos];
    abs_x = offset_x + spiral_search_x[pos];

    if (range_partly_outside) {
      if (abs_y >= 0 && abs_y <= max_height && abs_x >= 0 &&
          abs_x <= max_width) {
        PelYline_11 = FastLine16Y_11;
      } else {
        PelYline_11 = UMVLine16Y_11;
      }
    }

    orgptr = orig_blocks;
    bindex = 0;
    for (blky = 0; blky < 4; blky++) {
      LineSadBlk0 = LineSadBlk1 = LineSadBlk2 = LineSadBlk3 = 0;
      for (y = 0; y < 4; y++) {
        refptr = PelYline_11(ref_pic, abs_y++, abs_x, img_height, img_width);
...


With LTO and unswitched loop, we could fully inline FastLine16Y_11 and/or
UMVLine16Y_11, which could help a lot here since FastLine16Y_11 is a very small
function; see:

pel_t *FastLine16Y_11 (pel_t *Pic, int y, int x, int height, int width)
{
  return &Pic [y*width+x];
}

UMVLine16Y_11 is a bit bigger function.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191005/9258b4cb/attachment.html>


More information about the llvm-bugs mailing list