mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
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. llvm-svn: 124773
This commit is contained in:
parent
d2c741c07a
commit
5bfba89832
@ -2712,8 +2712,8 @@ static unsigned TranslateX86CC(ISD::CondCode SetCCOpcode, bool isFP,
|
||||
// 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);
|
||||
}
|
||||
|
12
test/CodeGen/X86/pr9127.ll
Normal file
12
test/CodeGen/X86/pr9127.ll
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user