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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to