InstCombine: Fix transform to use the swapped predicate.
[oota-llvm.git] / lib / Transforms / InstCombine / InstCombineCompares.cpp
index cb434bda57a80fc021b6a77893df03ad6f45be48..3e549d942823561ccd47613762d62e23682e2f54 100644 (file)
@@ -2855,10 +2855,10 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
       }
   }
 
-  // fcmp (fneg x), (fneg y) -> fcmp x, y
+  // fcmp pred (fneg x), (fneg y) -> fcmp swap(pred) x, y
   Value *X, *Y;
   if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
-    return new FCmpInst(I.getPredicate(), X, Y);
+    return new FCmpInst(I.getSwappedPredicate(), X, Y);
 
   // fcmp (fpext x), (fpext y) -> fcmp x, y
   if (FPExtInst *LHSExt = dyn_cast<FPExtInst>(Op0))