[LLVMbugs] [Bug 23875] New: AnalyzeBranch() fails on non-equality comparison between a float value and zero on X86.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 17 11:37:25 PDT 2015


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

            Bug ID: 23875
           Summary: AnalyzeBranch() fails on non-equality comparison
                    between a float value and zero on X86.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: congh at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In LLVM and on X86, AnalyzeBranch() returns true (which means failure) on the
branch in the following function:

void foo(float f) {
  if (f != 0)
    printf("*");
}

The generated machine code for this function is:


BB#0: derived from LLVM BB %entry
    Live Ins: %XMM0
        %XMM1<def,tied1> = XORPSrr %XMM1<undef,tied0>, %XMM1<undef>
        UCOMISSrr %XMM0<kill>, %XMM1<kill>, %EFLAGS<imp-def>
        JNE_1 <BB#1>, %EFLAGS<imp-use>
        JNP_1 <BB#2>, %EFLAGS<imp-use>
    Successors according to CFG: BB#1(1) BB#2(101)

BB#1: derived from LLVM BB %if.then
    Predecessors according to CFG: BB#0
        %EDI<def> = MOV32ri 42
        TAILJMPd64 <ga:@putchar>, <regmask>, %RSP<imp-use>, %RSP<imp-use>,
%EDI<imp-use,kill>

BB#2: derived from LLVM BB %if.end
    Predecessors according to CFG: BB#0
        RETQ


To reproduce this problem, compile the test case shown in the bottom with the
command:

clang++ -O2 test.C -c -mllvm -debug 2>&1  | grep "unanalyzable fallthrough"


You will see the message:

Pre-merging due to unanalyzable fallthrough: BB#0 (derived from LLVM BB
'entry') -> BB#1 (derived from LLVM BB 'if.then')


which is emitted from lib/CodeGen/MachineBlockPlacement.cpp.


The test case:


#include <stdio.h>

void foo(float f) {
  if (f != 0)
    printf("*");
}

-- 
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/20150617/b288ea47/attachment.html>


More information about the llvm-bugs mailing list