[llvm-bugs] [Bug 33253] New: missed interprocedural propagation opportunity

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 31 19:12:55 PDT 2017


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

            Bug ID: 33253
           Summary: missed interprocedural propagation opportunity
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: dberlin at dberlin.org, efriedma at codeaurora.org,
                    filcab at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, simon.f.whittaker at gmail.com

In the following testcase:

__attribute__((noinline)) 
static int f(int x)
{
  if (x > 300)
    return 1;
  else
    return 2;
}

int main(void)
{
  int a = f(1);
  int b = f(47);
  int c = f(219);
  return a + b + c;
}

we should be able to propagate the fact that x in f is never greater than 300,
so the predicate in f can be removed, as the function is not visible outside of
the TU.
This is a simplified testcase, but the optimization can be more important at
LTO time.

I don't think the "paper algorithm" that we have in SCCP is able to handle this
case.

-- 
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/20170601/ad03d714/attachment.html>


More information about the llvm-bugs mailing list