[clang] [llvm] [AArch64][SME] Add pass remarks to the MachineSMEABIPass (PR #170277)
Benjamin Maxwell via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 16 03:57:24 PST 2025
================
@@ -706,16 +723,101 @@ void MachineSMEABI::insertStateChanges(EmitContext &Context,
static DebugLoc getDebugLoc(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI) {
- if (MBBI != MBB.end())
- return MBBI->getDebugLoc();
- return DebugLoc();
+ if (MBB.empty())
+ return DebugLoc();
+ return MBBI != MBB.end() ? MBBI->getDebugLoc() : MBB.back().getDebugLoc();
+}
+
+static bool findMarkedCall(const MachineBasicBlock &MBB,
+ MachineBasicBlock::const_iterator MBBI,
+ SmallVectorImpl<const MachineInstr *> &Calls,
+ unsigned Marker, unsigned CallDestroyOpcode) {
+ auto IsMarker = [&](auto &MI) { return MI.getOpcode() == Marker; };
+ auto MarkerInst = std::find_if(MBBI, MBB.end(), IsMarker);
+ if (MarkerInst == MBB.end())
+ return false;
+ MachineBasicBlock::const_iterator I = MarkerInst;
+ while (++I != MBB.end()) {
+ if (I->isCall() || I->getOpcode() == CallDestroyOpcode)
+ break;
+ }
+ if (I != MBB.end() && I->isCall())
+ Calls.push_back(&*I);
+ // Note: This function always returns true if a "Marker" was found.
+ return true;
+}
+
+void MachineSMEABI::collectReachableMarkedCalls(
----------------
MacDue wrote:
There's a doc comment for `collectReachableMarkedCalls` on the `MachineSMEABI` class. I've added a doc comment for `findMarkedCall` :+1:
https://github.com/llvm/llvm-project/pull/170277
More information about the cfe-commits
mailing list