[llvm-branch-commits] [llvm] [CodeGen][NPM] Port LiveDebugValues to NPM (PR #131563)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Mar 16 22:19:13 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 bb1d6f1ef5fca622ce100e70e30f59dd1cd9fcbc b4613eade6cc67b3236c7a9ebf155ff20138b90d --extensions h,cpp -- llvm/include/llvm/InitializePasses.h llvm/include/llvm/Passes/CodeGenPassBuilder.h llvm/lib/CodeGen/CodeGen.cpp llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp llvm/lib/Passes/PassBuilder.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
index c580f5a3eb..9d16e0ddb1 100644
--- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
@@ -1000,7 +1000,8 @@ Error CodeGenPassBuilder<Derived, TargetMachineT>::addMachinePasses(
   addPass(FuncletLayoutPass());
 
   addPass(StackMapLivenessPass());
-  addPass(LiveDebugValuesPass(getTM<TargetMachine>().Options.ShouldEmitDebugEntryValues()));
+  addPass(LiveDebugValuesPass(
+      getTM<TargetMachine>().Options.ShouldEmitDebugEntryValues()));
   addPass(MachineSanitizerBinaryMetadata());
 
   if (TM.Options.EnableMachineOutliner &&
diff --git a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
index 585eff9a84..654e8eb022 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
@@ -84,6 +84,7 @@ struct LiveDebugValues {
   LiveDebugValues();
   ~LiveDebugValues() = default;
   bool run(MachineFunction &MF, bool ShouldEmitDebugEntryValues);
+
 private:
   std::unique_ptr<LDVImpl> InstrRefImpl;
   std::unique_ptr<LDVImpl> VarLocImpl;
@@ -95,8 +96,8 @@ char LiveDebugValuesLegacy::ID = 0;
 
 char &llvm::LiveDebugValuesID = LiveDebugValuesLegacy::ID;
 
-INITIALIZE_PASS(LiveDebugValuesLegacy, DEBUG_TYPE, "Live DEBUG_VALUE analysis", false,
-                false)
+INITIALIZE_PASS(LiveDebugValuesLegacy, DEBUG_TYPE, "Live DEBUG_VALUE analysis",
+                false, false)
 
 /// Default construct and initialize the pass.
 LiveDebugValuesLegacy::LiveDebugValuesLegacy() : MachineFunctionPass(ID) {
@@ -109,16 +110,18 @@ LiveDebugValues::LiveDebugValues() {
   VarLocImpl = std::unique_ptr<LDVImpl>(llvm::makeVarLocBasedLiveDebugValues());
 }
 
-PreservedAnalyses LiveDebugValuesPass::run(MachineFunction &MF,
-                                           MachineFunctionAnalysisManager &MFAM) {
-  if(!LiveDebugValues().run(MF, ShouldEmitDebugEntryValues))
+PreservedAnalyses
+LiveDebugValuesPass::run(MachineFunction &MF,
+                         MachineFunctionAnalysisManager &MFAM) {
+  if (!LiveDebugValues().run(MF, ShouldEmitDebugEntryValues))
     return PreservedAnalyses::all();
   auto PA = getMachineFunctionPassPreservedAnalyses();
   PA.preserveSet<CFGAnalyses>();
   return PA;
 }
 
-void LiveDebugValuesPass::printPipeline(raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName){
+void LiveDebugValuesPass::printPipeline(
+    raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
   OS << MapClassName2PassName(name());
   if (ShouldEmitDebugEntryValues)
     OS << "<emit-debug-entry-values>";
@@ -127,10 +130,12 @@ void LiveDebugValuesPass::printPipeline(raw_ostream &OS, function_ref<StringRef(
 bool LiveDebugValuesLegacy::runOnMachineFunction(MachineFunction &MF) {
   auto *TPC = getAnalysisIfAvailable<TargetPassConfig>();
   assert(TPC && "TargetPassConfig must be available");
-  return LiveDebugValues().run(MF, TPC->getTM<TargetMachine>().Options.ShouldEmitDebugEntryValues());
+  return LiveDebugValues().run(
+      MF, TPC->getTM<TargetMachine>().Options.ShouldEmitDebugEntryValues());
 }
 
-bool LiveDebugValues::run(MachineFunction &MF, bool ShouldEmitDebugEntryValues) {
+bool LiveDebugValues::run(MachineFunction &MF,
+                          bool ShouldEmitDebugEntryValues) {
   bool InstrRefBased = MF.useDebugInstrRef();
   // Allow the user to force selection of InstrRef LDV.
   InstrRefBased |= ForceInstrRefLDV;

``````````

</details>


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


More information about the llvm-branch-commits mailing list