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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124773
91177308-0d34-0410-b5e6-
96231b3b80d8
// 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);
}
--- /dev/null
+; 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