[LLVMbugs] [Bug 15737] New: Assert when combining an AND of two FCMPs.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 12 13:45:28 PDT 2013


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

            Bug ID: 15737
           Summary: Assert when combining an AND of two FCMPs.
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cameron.mcinally at nyu.edu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10346
  --> http://llvm.org/bugs/attachment.cgi?id=10346&action=edit
Tarball of preprocessed source, run script, and backtrace.

When compiling this function at -O2, Clang issues an assert:

int kung( float a, double b ) {
  return (a == a) & (b == b);
}

The assert is:

Assertion failed: (getOperand(0)->getType() == getOperand(1)->getType() &&
"Both operands to FCmp instruction are not of the same type!"), function
FCmpInst, file /Users/xkrebstarx/clang/llvm/include/llvm/IR/Instructions.h,
line 1117.


We begin with a float "a" and double "b":

> (fcmp oeq a, a) & (fcmp oeq b, b) 

After canonicalization in InstCombine, we end up with the expression:

> (fcmp ord a, 0.0) & (fcmp ord b, 0.0)

The bug manifest is in InstCombiner::FoldAndOfFCmps(FCmpInst *LHS, FCmpInst
*RHS), when trying to perform this transformation:

> (fcmp ord x, c) & (fcmp ord y, c)  -> (fcmp ord x, y)

This is all fine, except that the FCmpInst constructor in the IRBuilder
requires that both operands to the new fcmp are the same type, which they are
not.

-- 
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/20130412/597dd16a/attachment.html>


More information about the llvm-bugs mailing list