[PATCH] D147178: [MachineOutliner] Fix label outlining regression introduced in D125072
duk via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 30 11:18:14 PDT 2023
duck-37 updated this revision to Diff 509742.
duck-37 added a comment.
Fix diff.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147178/new/
https://reviews.llvm.org/D147178
Files:
llvm/lib/CodeGen/TargetInstrInfo.cpp
llvm/test/CodeGen/AArch64/machine-outliner-labels.mir
Index: llvm/test/CodeGen/AArch64/machine-outliner-labels.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/machine-outliner-labels.mir
@@ -0,0 +1,49 @@
+# RUN: llc -mtriple aarch64 -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s
+# CHECK-NOT: OUTLINED_FUNCTION
+
+...
+---
+name: foo1
+tracksRegLiveness: true
+machineFunctionInfo:
+ hasRedZone: false
+body: |
+ bb.0:
+ liveins: $x0
+ $x0 = ADDXri $x0, 0, 0
+ EH_LABEL <mcsymbol .Ltmp0>
+ EH_LABEL <mcsymbol .Ltmp1>
+ EH_LABEL <mcsymbol .Ltmp2>
+ EH_LABEL <mcsymbol .Ltmp3>
+ RET_ReallyLR implicit $x0
+...
+---
+name: foo2
+tracksRegLiveness: true
+machineFunctionInfo:
+ hasRedZone: false
+body: |
+ bb.0:
+ liveins: $x0
+ $x0 = ADDXri $x0, 0, 0
+ EH_LABEL <mcsymbol .Ltmp0>
+ EH_LABEL <mcsymbol .Ltmp1>
+ EH_LABEL <mcsymbol .Ltmp2>
+ EH_LABEL <mcsymbol .Ltmp3>
+ RET_ReallyLR implicit $x0
+...
+---
+name: foo3
+tracksRegLiveness: true
+machineFunctionInfo:
+ hasRedZone: false
+body: |
+ bb.0:
+ liveins: $x0
+ $x0 = ADDXri $x0, 0, 0
+ EH_LABEL <mcsymbol .Ltmp0>
+ EH_LABEL <mcsymbol .Ltmp1>
+ EH_LABEL <mcsymbol .Ltmp2>
+ EH_LABEL <mcsymbol .Ltmp3>
+ RET_ReallyLR implicit $x0
+...
Index: llvm/lib/CodeGen/TargetInstrInfo.cpp
===================================================================
--- llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -1579,10 +1579,6 @@
// Just go right to the target implementation.
return getOutliningTypeImpl(MIT, Flags);
- // Don't allow instructions that don't materialize to impact analysis.
- if (MI.isMetaInstruction())
- return outliner::InstrType::Invisible;
-
// Be conservative about inline assembly.
if (MI.isInlineAsm())
return outliner::InstrType::Illegal;
@@ -1591,6 +1587,21 @@
if (MI.isLabel())
return outliner::InstrType::Illegal;
+ // Don't let debug instructions impact analysis.
+ if (MI.isDebugInstr())
+ return outliner::InstrType::Invisible;
+
+ // Some other special cases.
+ switch (MI.getOpcode()) {
+ case TargetOpcode::IMPLICIT_DEF:
+ case TargetOpcode::KILL:
+ case TargetOpcode::LIFETIME_START:
+ case TargetOpcode::LIFETIME_END:
+ return outliner::InstrType::Invisible;
+ default:
+ break;
+ }
+
// Is this a terminator for a basic block?
if (MI.isTerminator()) {
// If this is a branch to another block, we can't outline it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147178.509742.patch
Type: text/x-patch
Size: 2602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230330/7bae1bc6/attachment.bin>
More information about the llvm-commits
mailing list