diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.h b/llvm/lib/Target/AArch64/AArch64ISelLowering.h --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.h +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.h @@ -840,6 +840,9 @@ EVT getAsmOperandValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown = false) const override; + unsigned + getMaxPermittedBytesForAlignment(MachineBasicBlock *MBB) const override; + private: /// Keep a pointer to the AArch64Subtarget around so that we can /// make the right decision when generating code for different targets. diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -8525,6 +8525,15 @@ return TargetLowering::getAsmOperandValueType(DL, Ty, AllowUnknown); } +unsigned AArch64TargetLowering::getMaxPermittedBytesForAlignment( + MachineBasicBlock *MBB) const { + // Base the max permitted bytes on the alignment value + Align A = MBB->getAlignment(); + if (A != Align(1)) + return A.value() - 1; + return TargetLowering::getMaxPermittedBytesForAlignment(MBB); +} + /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops /// vector. If it is invalid, don't add anything to Ops. void AArch64TargetLowering::LowerAsmOperandForConstraint(