1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00

[X86] Allow i16 subtracts to be promoted if the load is on the LHS and its not being stored.

llvm-svn: 328928
This commit is contained in:
Craig Topper 2018-04-01 06:29:25 +00:00
parent 4f8f0b27b1
commit 35a599747e
2 changed files with 6 additions and 5 deletions

View File

@ -38742,12 +38742,12 @@ bool X86TargetLowering::IsDesirableToPromoteOp(SDValue Op, EVT &PVT) const {
case ISD::SUB: {
SDValue N0 = Op.getOperand(0);
SDValue N1 = Op.getOperand(1);
if (!Commute && MayFoldLoad(N1))
return false;
// Avoid disabling potential load folding opportunities.
if (MayFoldLoad(N0) && (!isa<ConstantSDNode>(N1) || MayFoldIntoStore(Op)))
if (MayFoldLoad(N1) &&
(!Commute || !isa<ConstantSDNode>(N0) || MayFoldIntoStore(Op)))
return false;
if (MayFoldLoad(N1) && (!isa<ConstantSDNode>(N0) || MayFoldIntoStore(Op)))
if (MayFoldLoad(N0) &&
((Commute && !isa<ConstantSDNode>(N1)) || MayFoldIntoStore(Op)))
return false;
}
}

View File

@ -49,7 +49,8 @@ define signext i16 @baz(i16* %x, i16 signext %y) nounwind {
; X64-LABEL: baz:
; X64: # %bb.0: # %entry
; X64-NEXT: movzwl (%rdi), %eax
; X64-NEXT: subw %si, %ax
; X64-NEXT: subl %esi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
entry:
%0 = load i16, i16* %x