[clang] [llvm] [LLVM][PhaseOrdering] Run CSE after InstCombine has cleaned the result of vectorisation. (PR #120443)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 19 02:53:50 PST 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 3146911eb0eee821535444aa207a4ec5020c9c6a 1d42e0f61b43d7571e1a8bf52a245754a27f48b1 --extensions cpp,c -- clang/test/CodeGen/AArch64/sme-intrinsics/acle_sme_ld1_vnum.c clang/test/CodeGen/AArch64/sme-intrinsics/acle_sme_st1_vnum.c llvm/lib/Passes/PassBuilderPipelines.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 5cfebadfd1..b7e235f33d 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1316,27 +1316,27 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
     ExtraFunctionPassManager<ShouldRunExtraVectorPasses> ExtraPasses;
     ....
   }
- FPM.addPass(std::move(ExtraPasses));
-    // At higher optimization levels, try to clean up any runtime overlap and
-    // alignment checks inserted by the vectorizer. We want to track correlated
-    // runtime checks for two inner loops in the same outer loop, fold any
-    // common computations, hoist loop-invariant aspects out of any outer loop,
-    // and unswitch the runtime checks if possible. Once hoisted, we may have
-    // dead (or speculatable) control flows or more combining opportunities.
-    ExtraPasses.addPass(CorrelatedValuePropagationPass());
-    ExtraPasses.addPass(InstCombinePass());
-    LoopPassManager LPM;
-    LPM.addPass(LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
-                         /*AllowSpeculation=*/true));
-    LPM.addPass(SimpleLoopUnswitchPass(/* NonTrivial */ Level ==
-                                       OptimizationLevel::O3));
-    ExtraPasses.addPass(
-        createFunctionToLoopPassAdaptor(std::move(LPM), /*UseMemorySSA=*/true,
-                                        /*UseBlockFrequencyInfo=*/true));
-    ExtraPasses.addPass(
-        SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(true)));
-    ExtraPasses.addPass(InstCombinePass());
-    FPM.addPass(std::move(ExtraPasses));
+  FPM.addPass(std::move(ExtraPasses));
+  // At higher optimization levels, try to clean up any runtime overlap and
+  // alignment checks inserted by the vectorizer. We want to track correlated
+  // runtime checks for two inner loops in the same outer loop, fold any
+  // common computations, hoist loop-invariant aspects out of any outer loop,
+  // and unswitch the runtime checks if possible. Once hoisted, we may have
+  // dead (or speculatable) control flows or more combining opportunities.
+  ExtraPasses.addPass(CorrelatedValuePropagationPass());
+  ExtraPasses.addPass(InstCombinePass());
+  LoopPassManager LPM;
+  LPM.addPass(LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
+                       /*AllowSpeculation=*/true));
+  LPM.addPass(
+      SimpleLoopUnswitchPass(/* NonTrivial */ Level == OptimizationLevel::O3));
+  ExtraPasses.addPass(
+      createFunctionToLoopPassAdaptor(std::move(LPM), /*UseMemorySSA=*/true,
+                                      /*UseBlockFrequencyInfo=*/true));
+  ExtraPasses.addPass(
+      SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(true)));
+  ExtraPasses.addPass(InstCombinePass());
+  FPM.addPass(std::move(ExtraPasses));
   }
 
   // Now that we've formed fast to execute loop structures, we do further

``````````

</details>


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


More information about the cfe-commits mailing list