[clang] [llvm] [LLVM][PassBuilder] Extend the function signature of callback for optimizer pipeline extension point (PR #100945)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 28 12:57:18 PDT 2024


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 44df89cc30fc462dcb821929c6d5459688ffe545 b8c8357c3724031d85c96e3aa053acf402f3508e --extensions h,cpp -- clang/lib/CodeGen/BackendUtil.cpp llvm/include/llvm/Passes/PassBuilder.h llvm/lib/Passes/PassBuilderPipelines.cpp llvm/lib/Target/AMDGPU/AMDGPU.h llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp llvm/tools/opt/NewPMDriver.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 4beec01e2a..64f0020a17 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -642,13 +642,12 @@ static void addKCFIPass(const Triple &TargetTriple, const LangOptions &LangOpts,
     return;
 
   // Ensure we lower KCFI operand bundles with -O0.
-  PB.registerOptimizerLastEPCallback([&](ModulePassManager &MPM,
-                                         OptimizationLevel Level,
-                                         ThinOrFullLTOPhase) {
-    if (Level == OptimizationLevel::O0 &&
-        LangOpts.Sanitize.has(SanitizerKind::KCFI))
-      MPM.addPass(createModuleToFunctionPassAdaptor(KCFIPass()));
-  });
+  PB.registerOptimizerLastEPCallback(
+      [&](ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase) {
+        if (Level == OptimizationLevel::O0 &&
+            LangOpts.Sanitize.has(SanitizerKind::KCFI))
+          MPM.addPass(createModuleToFunctionPassAdaptor(KCFIPass()));
+      });
 
   // When optimizations are requested, run KCIFPass after InstCombine to
   // avoid unnecessary checks.

``````````

</details>


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


More information about the llvm-commits mailing list