diff options
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64InstrInfo.cpp | 5 | ||||
-rw-r--r-- | llvm/test/CodeGen/AArch64/machine-outliner-inline-asm-adrp.mir | 57 |
2 files changed, 62 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index 5732dbe7b01..6de4bb2143d 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -5061,6 +5061,11 @@ AArch64InstrInfo::getOutliningType(MachineBasicBlock::iterator &MIT, if (MOP.isCPI() || MOP.isJTI() || MOP.isCFIIndex() || MOP.isFI() || MOP.isTargetIndex()) return MachineOutlinerInstrType::Illegal; + + // If it uses LR or W30 explicitly, then don't touch it. + if (MOP.isReg() && !MOP.isImplicit() && + (MOP.getReg() == AArch64::LR || MOP.getReg() == AArch64::W30)) + return MachineOutlinerInstrType::Illegal; } // Special cases for instructions that can always be outlined, but will fail diff --git a/llvm/test/CodeGen/AArch64/machine-outliner-inline-asm-adrp.mir b/llvm/test/CodeGen/AArch64/machine-outliner-inline-asm-adrp.mir new file mode 100644 index 00000000000..4992c1a247a --- /dev/null +++ b/llvm/test/CodeGen/AArch64/machine-outliner-inline-asm-adrp.mir @@ -0,0 +1,57 @@ +# RUN: llc -simplify-mir -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s +# CHECK-NOT: OUTLINED_FUNCTION +--- | + target triple = "arm64----" + + @g = external global i64, align 8 + + define void @foo() #0 { + ret void + } + + define void @foo2() #0 { + ret void + } + + define void @foo3() #0 { + ret void + } + + attributes #0 = { nounwind noredzone } + +... +--- +name: foo +alignment: 2 +tracksRegLiveness: true +body: | + bb.0 (%ir-block.0): + liveins: $x27, $lr + $x27 = ADRP target-flags(aarch64-page, aarch64-got) @g + $lr = ADRP target-flags(aarch64-page, aarch64-got) @g + RET undef $lr + +... +--- +name: foo2 +alignment: 2 +tracksRegLiveness: true +body: | + bb.0 (%ir-block.0): + liveins: $x27, $lr + $x27 = ADRP target-flags(aarch64-page, aarch64-got) @g + $lr = ADRP target-flags(aarch64-page, aarch64-got) @g + RET undef $lr + +... +--- +name: foo3 +alignment: 2 +tracksRegLiveness: true +body: | + bb.0 (%ir-block.0): + liveins: $x27, $lr + $x27 = ADRP target-flags(aarch64-page, aarch64-got) @g + $lr = ADRP target-flags(aarch64-page, aarch64-got) @g + RET undef $lr +... |