[llvm-bugs] [Bug 31729] New: GVNHoist illegally hoists div instruction

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 23 18:52:04 PST 2017


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

            Bug ID: 31729
           Summary: GVNHoist illegally hoists div instruction
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: matze at braunis.de
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17884
  --> https://llvm.org/bugs/attachment.cgi?id=17884&action=edit
C reproducer

The attached testcase performs a division (by zero) before checking the
condition present in the original sourcecode. The problem appears when
compiling test-suite/SingleSource/UnitTests/SignlessTypes/rem.c with the -Oz
flag.

I reduced the test to a small reproducer and will attach them here. Looking at
the -print-after-all output it seems GVNHoist is to blame and the problem goes
away with -gvn-max-hoisted=0 for me.

I can reproduce this on a macOS system with:

$ clang -Oz reduced.c
$ ./a.out
Floating point exception: 8

I attached a -O0 -emit-llvm .ll file for convenience but did not test whether
that reproduces as well.

-- 
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/20170124/e9faa706/attachment.html>


More information about the llvm-bugs mailing list