[LLVMbugs] [Bug 12706] New: licm incorrectly hoists divide out of infinite loop, resulting in floating point exception

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 30 10:47:53 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12706

             Bug #: 12706
           Summary: licm incorrectly hoists divide out of infinite loop,
                    resulting in floating point exception
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: richard at xmos.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8477
  --> http://llvm.org/bugs/attachment.cgi?id=8477
bug.ll

Compiling the following at -O1 or above in clang results in the division (a /
b) being hoisted outside the loop and a floating point exception.

#include <stdio.h>

__attribute__((noinline)) int f(int a, int b)
{
  while (1) {
    if (b) {
      printf("%d\n", (a / b));
    }
  }
}

int main()
{
  f(1, 0);
  return 0;
}

I've attached the .ll file just before licm pass is run. The issue can be
recreated using opt -licm bug.ll -S and noticing that the sdiv instruction has
been hoisted before the loop.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list