diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.h b/llvm/lib/Target/AArch64/AArch64InstrInfo.h --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.h +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.h @@ -299,6 +299,8 @@ Optional describeLoadedValue(const MachineInstr &MI, Register Reg) const override; + unsigned int getTailDuplicateSizeOverride() const override; + static void decomposeStackOffsetForFrameOffsets(const StackOffset &Offset, int64_t &NumBytes, int64_t &NumPredicateVectors, diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -7183,6 +7183,10 @@ return get(Opc).TSFlags & AArch64::InstrFlagIsWhile; } +unsigned int AArch64InstrInfo::getTailDuplicateSizeOverride() const { + return 6; +} + unsigned llvm::getBLRCallOpcode(const MachineFunction &MF) { if (MF.getSubtarget().hardenSlsBlr()) return AArch64::BLRNoIP; diff --git a/llvm/test/CodeGen/AArch64/arm64-shrink-wrapping.ll b/llvm/test/CodeGen/AArch64/arm64-shrink-wrapping.ll --- a/llvm/test/CodeGen/AArch64/arm64-shrink-wrapping.ll +++ b/llvm/test/CodeGen/AArch64/arm64-shrink-wrapping.ll @@ -121,7 +121,7 @@ ; DISABLE-NEXT: b LBB1_5 ; DISABLE-NEXT: LBB1_4: ; %if.else ; DISABLE-NEXT: lsl w0, w1, #1 -; DISABLE-NEXT: LBB1_5: ; %if.end +; DISABLE-NEXT: LBB1_5: ; %for.end ; DISABLE-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload ; DISABLE-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload ; DISABLE-NEXT: ret @@ -278,7 +278,7 @@ ; DISABLE-NEXT: b LBB3_5 ; DISABLE-NEXT: LBB3_4: ; %if.else ; DISABLE-NEXT: lsl w0, w1, #1 -; DISABLE-NEXT: LBB3_5: ; %if.end +; DISABLE-NEXT: LBB3_5: ; %if.else ; DISABLE-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload ; DISABLE-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload ; DISABLE-NEXT: ret @@ -360,7 +360,7 @@ ; DISABLE-NEXT: b LBB4_5 ; DISABLE-NEXT: LBB4_4: ; %if.else ; DISABLE-NEXT: lsl w0, w1, #1 -; DISABLE-NEXT: LBB4_5: ; %if.end +; DISABLE-NEXT: LBB4_5: ; %for.end ; DISABLE-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload ; DISABLE-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload ; DISABLE-NEXT: ret @@ -614,10 +614,11 @@ ; DISABLE-NEXT: mov w0, w1 ; DISABLE-NEXT: bl _someVariadicFunc ; DISABLE-NEXT: lsl w0, w0, #3 -; DISABLE-NEXT: b LBB8_3 +; DISABLE-NEXT: ldp x29, x30, [sp, #48] ; 16-byte Folded Reload +; DISABLE-NEXT: add sp, sp, #64 ; =64 +; DISABLE-NEXT: ret ; DISABLE-NEXT: LBB8_2: ; %if.else ; DISABLE-NEXT: lsl w0, w1, #1 -; DISABLE-NEXT: LBB8_3: ; %if.end ; DISABLE-NEXT: ldp x29, x30, [sp, #48] ; 16-byte Folded Reload ; DISABLE-NEXT: add sp, sp, #64 ; =64 ; DISABLE-NEXT: ret diff --git a/llvm/test/CodeGen/AArch64/cgp-usubo.ll b/llvm/test/CodeGen/AArch64/cgp-usubo.ll --- a/llvm/test/CodeGen/AArch64/cgp-usubo.ll +++ b/llvm/test/CodeGen/AArch64/cgp-usubo.ll @@ -166,12 +166,14 @@ ; CHECK-NEXT: subs x8, x22, x21 ; CHECK-NEXT: b.hs .LBB8_3 ; CHECK-NEXT: // %bb.2: // %end -; CHECK-NEXT: cset w0, lo ; CHECK-NEXT: str x8, [x19] -; CHECK-NEXT: b .LBB8_4 +; CHECK-NEXT: ldp x20, x19, [sp, #32] // 16-byte Folded Reload +; CHECK-NEXT: ldp x22, x21, [sp, #16] // 16-byte Folded Reload +; CHECK-NEXT: cset w0, lo +; CHECK-NEXT: ldr x30, [sp], #48 // 8-byte Folded Reload +; CHECK-NEXT: ret ; CHECK-NEXT: .LBB8_3: // %f ; CHECK-NEXT: and w0, w20, #0x1 -; CHECK-NEXT: .LBB8_4: // %f ; CHECK-NEXT: ldp x20, x19, [sp, #32] // 16-byte Folded Reload ; CHECK-NEXT: ldp x22, x21, [sp, #16] // 16-byte Folded Reload ; CHECK-NEXT: ldr x30, [sp], #48 // 8-byte Folded Reload diff --git a/llvm/test/CodeGen/AArch64/ldst-paired-aliasing.ll b/llvm/test/CodeGen/AArch64/ldst-paired-aliasing.ll --- a/llvm/test/CodeGen/AArch64/ldst-paired-aliasing.ll +++ b/llvm/test/CodeGen/AArch64/ldst-paired-aliasing.ll @@ -29,10 +29,12 @@ ; CHECK-NEXT: b.ne .LBB0_2 ; CHECK-NEXT: // %bb.1: // %for.inc ; CHECK-NEXT: bl f -; CHECK-NEXT: b .LBB0_3 +; CHECK-NEXT: ldr x30, [sp, #96] // 8-byte Folded Reload +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: add sp, sp, #112 // =112 +; CHECK-NEXT: ret ; CHECK-NEXT: .LBB0_2: // %if.then ; CHECK-NEXT: bl f2 -; CHECK-NEXT: .LBB0_3: // %for.inc ; CHECK-NEXT: ldr x30, [sp, #96] // 8-byte Folded Reload ; CHECK-NEXT: mov w0, wzr ; CHECK-NEXT: add sp, sp, #112 // =112 diff --git a/llvm/test/CodeGen/AArch64/statepoint-call-lowering.ll b/llvm/test/CodeGen/AArch64/statepoint-call-lowering.ll --- a/llvm/test/CodeGen/AArch64/statepoint-call-lowering.ll +++ b/llvm/test/CodeGen/AArch64/statepoint-call-lowering.ll @@ -148,11 +148,12 @@ ; CHECK-NEXT: ldr x0, [sp, #8] ; CHECK-NEXT: bl consume ; CHECK-NEXT: and w0, w19, #0x1 -; CHECK-NEXT: b .LBB8_3 +; CHECK-NEXT: ldp x20, x19, [sp, #16] // 16-byte Folded Reload +; CHECK-NEXT: ldr x30, [sp], #32 // 8-byte Folded Reload +; CHECK-NEXT: ret ; CHECK-NEXT: .LBB8_2: // %right -; CHECK-NEXT: mov w0, #1 -; CHECK-NEXT: .LBB8_3: // %right ; CHECK-NEXT: ldp x20, x19, [sp, #16] // 16-byte Folded Reload +; CHECK-NEXT: mov w0, #1 ; CHECK-NEXT: ldr x30, [sp], #32 // 8-byte Folded Reload ; CHECK-NEXT: ret entry: