[llvm-bugs] [Bug 31478] New: No optimization of 'round' when arguments are known constants.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 27 03:35:36 PST 2016


            Bug ID: 31478
           Summary: No optimization of 'round' when arguments are known
           Product: libraries
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: brunojimen at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified


When checking the assembly output of a program I discovered that calls to
'round' wouldn't get optimized away when the argument is a known constant.

For example, with this little test case (the printf is there so the compiler
wouldn't just remove the call to round)

#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[])
    return 0;

using `clang -O2 -S` I get that there's a call to round in the assembly, while
`gcc -O2 -S` can remove the call to round.

More interesting is the case with '1.' instead of '0.9', in which the assembly
shows '1.' as float, a call to roundf and a conversion from float to double.

This may be a duplicate of https://llvm.org/bugs/show_bug.cgi?id=22944 but that
is about simplifying the calls, while this is about constant propagation.

Thanks in advance!

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/20161227/3d128b93/attachment-0001.html>

More information about the llvm-bugs mailing list