[llvm-commits] [llvm] r47750 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll

Chris Lattner sabre at nondot.org
Thu Feb 28 22:09:12 PST 2008


Author: lattner
Date: Fri Feb 29 00:09:11 2008
New Revision: 47750

URL: http://llvm.org/viewvc/llvm-project?rev=47750&view=rev
Log:
Folding or(fcmp,fcmp) only works if the operands of the fcmps are the same fp type.

Added:
    llvm/trunk/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll
Modified:
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=47750&r1=47749&r2=47750&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri Feb 29 00:09:11 2008
@@ -4287,7 +4287,8 @@
   if (FCmpInst *LHS = dyn_cast<FCmpInst>(I.getOperand(0))) {
     if (FCmpInst *RHS = dyn_cast<FCmpInst>(I.getOperand(1))) {
       if (LHS->getPredicate() == FCmpInst::FCMP_UNO &&
-          RHS->getPredicate() == FCmpInst::FCMP_UNO)
+          RHS->getPredicate() == FCmpInst::FCMP_UNO && 
+          LHS->getOperand(0)->getType() == RHS->getOperand(0)->getType())
         if (ConstantFP *LHSC = dyn_cast<ConstantFP>(LHS->getOperand(1)))
           if (ConstantFP *RHSC = dyn_cast<ConstantFP>(RHS->getOperand(1))) {
             // If either of the constants are nans, then the whole thing returns

Added: llvm/trunk/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll?rev=47750&view=auto

==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll Fri Feb 29 00:09:11 2008
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+; rdar://5771353
+
+define float @test(float %x, x86_fp80 %y) nounwind readonly  {
+entry:
+	%tmp67 = fcmp uno x86_fp80 %y, 0xK00000000000000000000		; <i1> [#uses=1]
+	%tmp71 = fcmp uno float %x, 0.000000e+00		; <i1> [#uses=1]
+	%bothcond = or i1 %tmp67, %tmp71		; <i1> [#uses=1]
+	br i1 %bothcond, label %bb74, label %bb80
+
+bb74:		; preds = %entry
+	ret float 0.000000e+00
+
+bb80:		; preds = %entry
+	ret float 0.000000e+00
+}





More information about the llvm-commits mailing list