forked from OSchip/llvm-project
[X86] Disable load folding for X86ISD::ADD with 128 as an immediate.
It can be turned into a sub with -128 instead as long as the carry flag isn't used.
This commit is contained in:
parent
c7fa409bca
commit
dd0b18e1ec
|
@ -643,6 +643,11 @@ X86DAGToDAGISel::IsProfitableToFold(SDValue N, SDNode *U, SDNode *Root) const {
|
|||
if ((U->getOpcode() == ISD::ADD || U->getOpcode() == ISD::SUB) &&
|
||||
(-Imm->getAPIntValue()).isSignedIntN(8))
|
||||
return false;
|
||||
|
||||
if ((U->getOpcode() == X86ISD::ADD || U->getOpcode() == X86ISD::SUB) &&
|
||||
(-Imm->getAPIntValue()).isSignedIntN(8) &&
|
||||
hasNoCarryFlagUses(SDValue(U, 1)))
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the other operand is a TLS address, we should fold it instead.
|
||||
|
|
|
@ -560,8 +560,8 @@ declare void @bar_i64(i64)
|
|||
define void @add_i32_128_flag(i32 %x) {
|
||||
; X32-LABEL: add_i32_128_flag:
|
||||
; X32: # %bb.0: # %entry
|
||||
; X32-NEXT: movl $128, %eax
|
||||
; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X32-NEXT: subl $-128, %eax
|
||||
; X32-NEXT: je .LBB19_2
|
||||
; X32-NEXT: # %bb.1: # %if.then
|
||||
; X32-NEXT: pushl %eax
|
||||
|
|
Loading…
Reference in New Issue