[llvm] r327760 - [MachineOutliner] Make KILLs invisible

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 16 15:53:34 PDT 2018


Author: paquette
Date: Fri Mar 16 15:53:34 2018
New Revision: 327760

URL: http://llvm.org/viewvc/llvm-project?rev=327760&view=rev
Log:
[MachineOutliner] Make KILLs invisible

At the point the outliner runs, KILLs don't impact anything, but they're still
considered unique instructions. This commit makes them invisible like
DebugValues so that they can still be outlined without impacting outlining
decisions.


Modified:
    llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
    llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
    llvm/trunk/test/CodeGen/AArch64/machine-outliner.mir

Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp?rev=327760&r1=327759&r2=327760&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp Fri Mar 16 15:53:34 2018
@@ -5036,6 +5036,11 @@ AArch64InstrInfo::getOutliningType(Machi
   // 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()) {

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=327760&r1=327759&r2=327760&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Mar 16 15:53:34 2018
@@ -11217,6 +11217,11 @@ X86InstrInfo::getOutliningType(MachineBa
   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;

Modified: llvm/trunk/test/CodeGen/AArch64/machine-outliner.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/machine-outliner.mir?rev=327760&r1=327759&r2=327760&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/machine-outliner.mir (original)
+++ llvm/trunk/test/CodeGen/AArch64/machine-outliner.mir Fri Mar 16 15:53:34 2018
@@ -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




More information about the llvm-commits mailing list