[llvm-commits] [llvm] r128628 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCompares.cpp test/Transforms/InstCombine/fcmp.ll
Benjamin Kramer
benny.kra at googlemail.com
Thu Mar 31 03:46:03 PDT 2011
Author: d0k
Date: Thu Mar 31 05:46:03 2011
New Revision: 128628
URL: http://llvm.org/viewvc/llvm-project?rev=128628&view=rev
Log:
InstCombine: Fix transform to use the swapped predicate.
Thanks Frits!
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/trunk/test/Transforms/InstCombine/fcmp.ll
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=128628&r1=128627&r2=128628&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Thu Mar 31 05:46:03 2011
@@ -2855,10 +2855,10 @@
}
}
- // 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))
Modified: llvm/trunk/test/Transforms/InstCombine/fcmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fcmp.ll?rev=128628&r1=128627&r2=128628&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fcmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fcmp.ll Thu Mar 31 05:46:03 2011
@@ -44,7 +44,7 @@
define i1 @test6(float %x, float %y) nounwind {
%neg1 = fsub float -0.000000e+00, %x
%neg2 = fsub float -0.000000e+00, %y
- %cmp = fcmp ogt float %neg1, %neg2
+ %cmp = fcmp olt float %neg1, %neg2
ret i1 %cmp
; CHECK: @test6
; CHECK-NEXT: fcmp ogt float %x, %y
More information about the llvm-commits
mailing list