[llvm] r330783 - [MachineOutliner] Check for explicit uses of LR/W30 in MI operands
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 24 15:38:15 PDT 2018
Author: paquette
Date: Tue Apr 24 15:38:15 2018
New Revision: 330783
URL: http://llvm.org/viewvc/llvm-project?rev=330783&view=rev
Log:
[MachineOutliner] Check for explicit uses of LR/W30 in MI operands
Before, the outliner would grab ADRPs that used LR/W30. This patch fixes
that by checking for explicit uses of those registers before the special-casing
for ADRPs.
This also adds a test that ensures that those sorts of ADRPs won't be outlined.
Added:
llvm/trunk/test/CodeGen/AArch64/machine-outliner-inline-asm-adrp.mir
Modified:
llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp?rev=330783&r1=330782&r2=330783&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp Tue Apr 24 15:38:15 2018
@@ -5061,6 +5061,11 @@ AArch64InstrInfo::getOutliningType(Machi
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
Added: llvm/trunk/test/CodeGen/AArch64/machine-outliner-inline-asm-adrp.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/machine-outliner-inline-asm-adrp.mir?rev=330783&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/machine-outliner-inline-asm-adrp.mir (added)
+++ llvm/trunk/test/CodeGen/AArch64/machine-outliner-inline-asm-adrp.mir Tue Apr 24 15:38:15 2018
@@ -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
+...
More information about the llvm-commits
mailing list