[llvm] [Hexagon] Don't run hexagon-loop-idiom and hexagon-vlcr passes at O0 pipeline (PR #175891)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 13 22:01:46 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-hexagon

Author: None (pkarveti)

<details>
<summary>Changes</summary>

Fixes #<!-- -->156787 

---
Full diff: https://github.com/llvm/llvm-project/pull/175891.diff


2 Files Affected:

- (modified) llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp (+4-2) 
- (added) llvm/test/CodeGen/Hexagon/print-pipeline-passes.ll (+11) 


``````````diff
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
index d9824a3154093..3662facf07eeb 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
@@ -269,11 +269,13 @@ void HexagonTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
 
   PB.registerLateLoopOptimizationsEPCallback(
       [=](LoopPassManager &LPM, OptimizationLevel Level) {
-        LPM.addPass(HexagonLoopIdiomRecognitionPass());
+        if (Level.getSpeedupLevel() > 0)
+          LPM.addPass(HexagonLoopIdiomRecognitionPass());
       });
   PB.registerLoopOptimizerEndEPCallback(
       [=](LoopPassManager &LPM, OptimizationLevel Level) {
-        LPM.addPass(HexagonVectorLoopCarriedReusePass());
+        if (Level.getSpeedupLevel() > 0)
+          LPM.addPass(HexagonVectorLoopCarriedReusePass());
       });
 }
 
diff --git a/llvm/test/CodeGen/Hexagon/print-pipeline-passes.ll b/llvm/test/CodeGen/Hexagon/print-pipeline-passes.ll
new file mode 100644
index 0000000000000..0f80e9c60c441
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/print-pipeline-passes.ll
@@ -0,0 +1,11 @@
+; RUN: opt -mtriple=hexagon -S -passes='default<O0>' -print-pipeline-passes < %s 2>&1 | FileCheck --check-prefix=O0 %s
+; RUN: opt -mtriple=hexagon -S -passes='default<O2>' -print-pipeline-passes < %s 2>&1 | FileCheck %s
+
+; CHECK: hexagon-loop-idiom
+; CHECK: hexagon-vlcr
+; O0: {{^}}function(ee-instrument<>),always-inline,coro-cond(coro-early,cgscc(coro-split),coro-cleanup,globaldce),alloc-token,function(annotation-remarks),verify,print{{$}}
+
+define void @test_hexagon_passes() {
+entry:
+  ret void
+}

``````````

</details>


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


More information about the llvm-commits mailing list