[llvm] [SystemZ] Add proper mcount handling (PR #135767)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 15 02:45:07 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp b/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
index 0936690da..c05ec6cba 100644
--- a/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
@@ -562,7 +562,9 @@ void SystemZELFFrameLowering::emitPrologue(MachineFunction &MF,
   DebugLoc DL;
 
   // Add mcount instrumentation if necessary.
-  if (MF.getFunction().getFnAttribute("instrument-function-entry-inlined").getValueAsString() == "mcount") {
+  if (MF.getFunction()
+          .getFnAttribute("instrument-function-entry-inlined")
+          .getValueAsString() == "mcount") {
 
     // Store return address 8 bytes above stack pointer.
     BuildMI(MBB, MBBI, DL, ZII->get(SystemZ::STG))
@@ -580,10 +582,10 @@ void SystemZELFFrameLowering::emitPrologue(MachineFunction &MF,
 
     // Reload return address drom 8 bytes above stack pointer.
     BuildMI(MBB, MBBI, DL, ZII->get(SystemZ::LG))
-      .addReg(SystemZ::R14D)
-      .addReg(SystemZ::R15D)
-      .addImm(8)
-      .addReg(0);
+        .addReg(SystemZ::R14D)
+        .addReg(SystemZ::R15D)
+        .addImm(8)
+        .addReg(0);
   }
 
   // The current offset of the stack pointer from the CFA.
diff --git a/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp b/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
index 72e4f8791..5121103c4 100644
--- a/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
+++ b/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
@@ -65,7 +65,8 @@ static bool insertCall(Function &CurFn, StringRef Func,
       Call->setDebugLoc(DL);
     } else if (TargetTriple.isSystemZ()) {
       M.getOrInsertFunction(Func, Type::getVoidTy(C));
-      // skip insertion for `mcount` on SystemZ. This will be handled later in `emitPrologue`.
+      // skip insertion for `mcount` on SystemZ. This will be handled later in
+      // `emitPrologue`.
       return false;
     } else {
       FunctionCallee Fn = M.getOrInsertFunction(Func, Type::getVoidTy(C));

``````````

</details>


https://github.com/llvm/llvm-project/pull/135767


More information about the llvm-commits mailing list