summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstrInfo.cpp5
-rw-r--r--llvm/lib/Target/X86/X86InstrInfo.cpp5
-rw-r--r--llvm/test/CodeGen/AArch64/machine-outliner.mir3
3 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index b4231d6ff05..0164905a3e0 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -5036,6 +5036,11 @@ AArch64InstrInfo::getOutliningType(MachineBasicBlock::iterator &MIT,
// Don't allow debug values to impact outlining type.
if (MI.isDebugValue() || MI.isIndirectDebugValue())
return MachineOutlinerInstrType::Invisible;
+
+ // At this point, KILL instructions don't really tell us much so we can go
+ // ahead and skip over them.
+ if (MI.isKill())
+ return MachineOutlinerInstrType::Invisible;
// Is this a terminator for a basic block?
if (MI.isTerminator()) {
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 11e0b68a664..3d92e742b87 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -11217,6 +11217,11 @@ X86InstrInfo::getOutliningType(MachineBasicBlock::iterator &MIT, unsigned Flags
if (MI.isDebugValue() || MI.isIndirectDebugValue())
return MachineOutlinerInstrType::Invisible;
+ // At this point, KILL instructions don't really tell us much so we can go
+ // ahead and skip over them.
+ if (MI.isKill())
+ return MachineOutlinerInstrType::Invisible;
+
// Is this a tail call? If yes, we can outline as a tail call.
if (isTailCall(MI))
return MachineOutlinerInstrType::Legal;
diff --git a/llvm/test/CodeGen/AArch64/machine-outliner.mir b/llvm/test/CodeGen/AArch64/machine-outliner.mir
index ae508dc98c3..79d0ed2d070 100644
--- a/llvm/test/CodeGen/AArch64/machine-outliner.mir
+++ b/llvm/test/CodeGen/AArch64/machine-outliner.mir
@@ -100,12 +100,14 @@ body: |
...
---
# This test ensures that we can avoid saving LR when it's available.
+# It also makes sure that KILL instructions don't impact outlining.
# CHECK-LABEL: bb.1:
# CHECK-NOT: BL @baz, implicit-def dead $lr, implicit $sp
# CHECK: BL @OUTLINED_FUNCTION_[[F1:[0-9]+]], implicit-def $lr, implicit $sp
# CHECK-NEXT: $w17 = ORRWri $wzr, 2
# CHECK-NEXT: BL @OUTLINED_FUNCTION_[[F1]], implicit-def $lr, implicit $sp
# CHECK-NEXT: $w8 = ORRWri $wzr, 0
+# CHECK-NOT: $w17 = KILL renamable $w17, implicit killed $w17
name: bar
tracksRegLiveness: true
body: |
@@ -118,6 +120,7 @@ body: |
BL @baz, implicit-def dead $lr, implicit $sp
$w17 = ORRWri $wzr, 1
$w17 = ORRWri $wzr, 1
+ $w17 = KILL renamable $w17, implicit killed $w17
$w17 = ORRWri $wzr, 1
$w17 = ORRWri $wzr, 1
BL @baz, implicit-def dead $lr, implicit $sp
OpenPOWER on IntegriCloud