[PATCH] D147415: [MachineOutliner] Avoid outlining XRay pseudo-instructions
duk via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 2 13:01:28 PDT 2023
duck-37 created this revision.
duck-37 added a reviewer: paquette.
Herald added subscribers: hiraditya, dberris.
Herald added a project: All.
duck-37 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Outlining these can cause assertion failures and runs counter to what XRay is meant for anyway (fine-grained profiling via compiler instrumentation). Unblocks https://reviews.llvm.org/D124707
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147415
Files:
llvm/lib/CodeGen/TargetInstrInfo.cpp
llvm/test/CodeGen/AArch64/machine-outliner-patchable-exit.mir
Index: llvm/test/CodeGen/AArch64/machine-outliner-patchable-exit.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/machine-outliner-patchable-exit.mir
@@ -0,0 +1,30 @@
+# 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
+ PATCHABLE_FUNCTION_EXIT
+ RET_ReallyLR implicit $x0
+
+...
+---
+name: foo2
+tracksRegLiveness: true
+machineFunctionInfo:
+ hasRedZone: false
+body: |
+ bb.0:
+ liveins: $x0
+ $x0 = ADDXri $x0, 0, 0
+ PATCHABLE_FUNCTION_EXIT
+ RET_ReallyLR implicit $x0
+
+...
Index: llvm/lib/CodeGen/TargetInstrInfo.cpp
===================================================================
--- llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -1598,6 +1598,15 @@
case TargetOpcode::LIFETIME_START:
case TargetOpcode::LIFETIME_END:
return outliner::InstrType::Invisible;
+ case TargetOpcode::PATCHABLE_FUNCTION_ENTER:
+ case TargetOpcode::PATCHABLE_RET:
+ case TargetOpcode::PATCHABLE_FUNCTION_EXIT:
+ case TargetOpcode::PATCHABLE_TAIL_CALL:
+ case TargetOpcode::PATCHABLE_EVENT_CALL:
+ case TargetOpcode::PATCHABLE_TYPED_EVENT_CALL:
+ // XRay pseudo-instructions can't safely be outlined, and
+ // shouldn't be either way due to their intended purpose.
+ return outliner::InstrType::Illegal;
default:
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147415.510363.patch
Type: text/x-patch
Size: 1691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230402/35503b56/attachment.bin>
More information about the llvm-commits
mailing list