[llvm-commits] [llvm] r128624 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCompares.cpp test/Transforms/InstCombine/fcmp.ll
Benjamin Kramer
benny.kra at googlemail.com
Thu Mar 31 03:11:58 PDT 2011
Author: d0k
Date: Thu Mar 31 05:11:58 2011
New Revision: 128624
URL: http://llvm.org/viewvc/llvm-project?rev=128624&view=rev
Log:
InstCombine: fold fcmp (fpext x), (fpext y) -> fcmp x, y.
Added:
llvm/trunk/test/Transforms/InstCombine/fcmp.ll
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=128624&r1=128623&r2=128624&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Thu Mar 31 05:11:58 2011
@@ -2813,5 +2813,12 @@
}
}
+ // fcmp (fpext x), (fpext y) -> fcmp x, y
+ if (FPExtInst *LHSExt = dyn_cast<FPExtInst>(Op0))
+ if (FPExtInst *RHSExt = dyn_cast<FPExtInst>(Op1))
+ if (LHSExt->getSrcTy() == RHSExt->getSrcTy())
+ return new FCmpInst(I.getPredicate(), LHSExt->getOperand(0),
+ RHSExt->getOperand(0));
+
return Changed ? &I : 0;
}
Added: llvm/trunk/test/Transforms/InstCombine/fcmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fcmp.ll?rev=128624&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fcmp.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/fcmp.ll Thu Mar 31 05:11:58 2011
@@ -0,0 +1,11 @@
+; RUN: opt -S -instcombine < %s | FileCheck %s
+
+define i1 @test1(float %x, float %y) nounwind {
+ %ext1 = fpext float %x to double
+ %ext2 = fpext float %y to double
+ %cmp = fcmp ogt double %ext1, %ext2
+ ret i1 %cmp
+; CHECK: @test1
+; CHECK-NEXT: fcmp ogt float %x, %y
+}
+
More information about the llvm-commits
mailing list