[llvm-commits] [llvm] r124773 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/pr9127.ll

Rafael Espindola rafael.espindola at gmail.com
Wed Feb 2 19:58:05 PST 2011


Author: rafael
Date: Wed Feb  2 21:58:05 2011
New Revision: 124773

URL: http://llvm.org/viewvc/llvm-project?rev=124773&view=rev
Log:
Fix PR9127 by reversing the operands even if they have more then one use.
Reversing the operands allows us to fold, but doesn't force us to. Also, at
this point the DAG is still being optimized, so the check for hasOneUse is not
very precise.

Added:
    llvm/trunk/test/CodeGen/X86/pr9127.ll
Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124773&r1=124772&r2=124773&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Feb  2 21:58:05 2011
@@ -2712,8 +2712,8 @@
   // First determine if it is required or is profitable to flip the operands.
 
   // If LHS is a foldable load, but RHS is not, flip the condition.
-  if ((ISD::isNON_EXTLoad(LHS.getNode()) && LHS.hasOneUse()) &&
-      !(ISD::isNON_EXTLoad(RHS.getNode()) && RHS.hasOneUse())) {
+  if (ISD::isNON_EXTLoad(LHS.getNode()) &&
+      !ISD::isNON_EXTLoad(RHS.getNode())) {
     SetCCOpcode = getSetCCSwappedOperands(SetCCOpcode);
     std::swap(LHS, RHS);
   }

Added: llvm/trunk/test/CodeGen/X86/pr9127.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr9127.ll?rev=124773&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pr9127.ll (added)
+++ llvm/trunk/test/CodeGen/X86/pr9127.ll Wed Feb  2 21:58:05 2011
@@ -0,0 +1,12 @@
+; RUN: llc < %s | FileCheck %s
+
+define i8 @foobar(double %d, double* %x) {
+entry:
+  %tmp2 = load double* %x, align 8
+  %cmp = fcmp oeq double %tmp2, %d
+  %conv3 = zext i1 %cmp to i8
+  ret i8 %conv3
+}
+
+; test that the load is folded.
+; CHECK: ucomisd	(%rdi), %xmm0





More information about the llvm-commits mailing list