Skip to content

Commit 765b37a

Browse files
committed
[AArch64][GlobalISel] Fallback if the +strict-align target feature is given.
Works around PR44246.
1 parent 8d508c5 commit 765b37a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,14 @@ bool AArch64InstructionSelector::select(MachineInstr &I) {
14231423
MachineFunction &MF = *MBB.getParent();
14241424
MachineRegisterInfo &MRI = MF.getRegInfo();
14251425

1426+
const AArch64Subtarget *Subtarget =
1427+
&static_cast<const AArch64Subtarget &>(MF.getSubtarget());
1428+
if (Subtarget->requiresStrictAlign()) {
1429+
// We don't support this feature yet.
1430+
LLVM_DEBUG(dbgs() << "AArch64 GISel does not support strict-align yet\n");
1431+
return false;
1432+
}
1433+
14261434
unsigned Opcode = I.getOpcode();
14271435
// G_PHI requires same handling as PHI
14281436
if (!isPreISelGenericOpcode(Opcode) || Opcode == TargetOpcode::G_PHI) {

llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,12 @@ define <4 x i16> @zext_v4s8(<4 x i8> %in) {
209209
ret <4 x i16> %ext
210210
}
211211

212+
; FALLBACK-WITH-REPORT-ERR: remark: <unknown>:0:0: cannot select: RET_ReallyLR implicit $x0 (in function: strict_align_feature)
213+
; FALLBACK-WITH-REPORT-ERR: warning: Instruction selection used fallback path for strict_align_feature
214+
; FALLBACK-WITH-REPORT-OUT-LABEL: strict_align_feature
215+
define i64 @strict_align_feature(i64* %p) #0 {
216+
%x = load i64, i64* %p, align 1
217+
ret i64 %x
218+
}
219+
220+
attributes #0 = { "target-features"="+strict-align" }

0 commit comments

Comments
 (0)