[llvm-bugs] [Bug 26990] New: -fno-builtin and -fno-builtin-foo disable optimizations that introduce builtin calls (e.g., LIR)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 18 14:18:56 PDT 2016


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

            Bug ID: 26990
           Summary: -fno-builtin and -fno-builtin-foo disable
                    optimizations that introduce builtin calls (e.g., LIR)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: mcrosier at codeaurora.org
                CC: bob.wilson at apple.com, dexonsmith at apple.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

The -fno-builtin option says don't recognize built-in functions that do not
begin with __builtin__ as a prefix.  This is done to prevent the compiler from
optimizing such calls in the original program.  However, it isn't clear to me
(or Duncan or Bob) that this should prevent the compiler from introducing new
calls to builtin functions.

For example, this bit of code is recognized by the loop idiom pass as a memset:

void foo(int *arr) {
  for (unsigned i = 0; i < 8192; ++i)
    arr[i] = 0;
}

When compiling with gcc, the -fno-builtin and -fno-builtin-memset options don't
prevent gcc from converting this loop into a memset:

$> aarch64-linux-gnu-gcc -O3 test.c -o - -S -fno-builtin-memset | grep memset
     b    memset

However, the same is not true when compiling with LLVM.

-- 
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/20160318/6ea12d9d/attachment.html>


More information about the llvm-bugs mailing list