[llvm] [IR][Instructions] Add `CallBase::getCalledFunctionName` helper (PR #127038)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 05:36:45 PST 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 9d92bea507be19f4a3dba6107aa5eeb6e95a2765 2f05b4ea1a27de2d851b67bc1c89221c8114bfee --extensions h,cpp -- llvm/include/llvm/Analysis/VectorUtils.h llvm/include/llvm/IR/InstrTypes.h llvm/lib/Analysis/IRSimilarityIdentifier.cpp llvm/lib/Analysis/KernelInfo.cpp llvm/lib/Analysis/ReplayInlineAdvisor.cpp llvm/lib/IR/AutoUpgrade.cpp llvm/lib/Target/AArch64/AArch64ISelLowering.cpp llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp llvm/lib/Transforms/IPO/OpenMPOpt.cpp llvm/lib/Transforms/IPO/SampleProfile.cpp llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp llvm/lib/Transforms/Utils/InjectTLIMappings.cpp llvm/lib/Transforms/Utils/InlineFunction.cpp llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp llvm/unittests/Analysis/InlineOrderPlugin/InlineOrderPlugin.cpp llvm/unittests/Analysis/PluginInlineAdvisorAnalysisTest.cpp llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp llvm/unittests/IR/IRBuilderTest.cpp llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index f01e0b0fb7..875b9055b8 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -9034,21 +9034,19 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
     CalleeAttrs = SMEAttrs(ES->getSymbol());
 
   auto DescribeCallsite =
-          [&](OptimizationRemarkAnalysis &R) -> OptimizationRemarkAnalysis & {
-      R << "call from '" << ore::NV("Caller", MF.getName()) << "' to '";
-      if (auto *ES = dyn_cast<ExternalSymbolSDNode>(CLI.Callee)) {
-          R << ore::NV("Callee", ES->getSymbol());
-      }
-      else if (CLI.CB) {
-          const std::optional<StringRef> CalleeName =
-                  CLI.CB->getCalledFunctionName();
-          R << ore::NV("Callee", CalleeName.value_or("unknown callee"));
-      }
-      else {
-          R << "unknown callee";
-      }
-      R << "'";
-      return R;
+      [&](OptimizationRemarkAnalysis &R) -> OptimizationRemarkAnalysis & {
+    R << "call from '" << ore::NV("Caller", MF.getName()) << "' to '";
+    if (auto *ES = dyn_cast<ExternalSymbolSDNode>(CLI.Callee)) {
+      R << ore::NV("Callee", ES->getSymbol());
+    } else if (CLI.CB) {
+      const std::optional<StringRef> CalleeName =
+          CLI.CB->getCalledFunctionName();
+      R << ore::NV("Callee", CalleeName.value_or("unknown callee"));
+    } else {
+      R << "unknown callee";
+    }
+    R << "'";
+    return R;
   };
 
   bool RequiresLazySave = CallerAttrs.requiresLazySave(CalleeAttrs);

``````````

</details>


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


More information about the llvm-commits mailing list