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: unassignedb...@nondot.org
          Reporter: ma...@braunis.de
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to