Skip to content

Commit ef57977

Browse files
authored
[NewPM][Hexagon] Add HexagonPassRegistry.def (#86244)
Prepare for dag-isel, also migrate some test case
1 parent 2f1f6b7 commit ef57977

16 files changed

+41
-5
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===- HexagonPassRegistry.def - Registry of Hexagon passes -----*- C++--*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file is used as the registry of passes that are part of the
10+
// Hexagon backend.
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
// NOTE: NO INCLUDE GUARD DESIRED!
15+
16+
#ifndef LOOP_PASS
17+
#define LOOP_PASS(NAME, CREATE_PASS)
18+
#endif
19+
LOOP_PASS("hexagon-loop-idiom", HexagonLoopIdiomRecognitionPass())
20+
LOOP_PASS("hexagon-vlcr", HexagonVectorLoopCarriedReusePass())
21+
#undef LOOP_PASS

llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ HexagonTargetMachine::getSubtargetImpl(const Function &F) const {
299299

300300
void HexagonTargetMachine::registerPassBuilderCallbacks(
301301
PassBuilder &PB, bool PopulateClassToPassNames) {
302+
#define GET_PASS_REGISTRY "HexagonPassRegistry.def"
303+
#include "llvm/Passes/TargetPassRegistry.inc"
304+
302305
PB.registerLateLoopOptimizationsEPCallback(
303306
[=](LoopPassManager &LPM, OptimizationLevel Level) {
304307
LPM.addPass(HexagonLoopIdiomRecognitionPass());

llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt < %s -hexagon-vlcr | opt -passes=adce -S | FileCheck %s
1+
; RUN: opt -mtriple=hexagon-- -passes='loop(hexagon-vlcr),adce' -S %s | FileCheck %s
22

33
; CHECK: %.hexagon.vlcr = tail call <32 x i32> @llvm.hexagon.V6.vmaxub.128B
44
; ModuleID = 'hexagon_vector_loop_carried_reuse.c'

llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_commutative.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt < %s -march=hexagon -hexagon-vlcr | opt -passes=adce -S | FileCheck %s
1+
; RUN: opt -mtriple hexagon-- -passes='loop(hexagon-vlcr),adce' -S %s | FileCheck %s
22

33
; CHECK: %v32.hexagon.vlcr = tail call <32 x i32> @llvm.hexagon.V6.vmaxub.128B
44

llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_constant.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt < %s -hexagon-vlcr | opt -passes=adce -S | FileCheck %s
1+
; RUN: opt -mtriple=hexagon-- -passes='loop(hexagon-vlcr),adce' -S %s | FileCheck %s
22

33
; CHECK-NOT: %.hexagon.vlcr
44
; ModuleID = 'hexagon_vector_loop_carried_reuse.c'

llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_invalid.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -hexagon-vlcr < %s -S | FileCheck %s
1+
; RUN: opt -mtriple=hexagon-- -passes=hexagon-vlcr -S %s | FileCheck %s
22

33
; Test that reuse doesn't occur due to two shufflevectors with different masks.
44

llvm/test/CodeGen/Hexagon/hvx-loopidiom-memcpy.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -march=hexagon -hexagon-loop-idiom -S < %s | FileCheck %s
2+
; RUN: opt -mtriple=hexagon-- -p hexagon-loop-idiom -disable-memcpy-idiom -S < %s | FileCheck %s
23

34
; Make sure we don't convert load/store loops into memcpy if the access type
45
; is a vector. Using vector instructions is generally better in such cases.

llvm/test/CodeGen/Hexagon/loop-idiom/hexagon-memmove1.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
; Check for recognizing the "memmove" idiom.
22
; RUN: opt -hexagon-loop-idiom -S -mtriple hexagon-unknown-elf < %s \
33
; RUN: | FileCheck %s
4+
; RUN: opt -p hexagon-loop-idiom -S -mtriple hexagon-unknown-elf < %s \
5+
; RUN: | FileCheck %s
46
; CHECK: call void @llvm.memmove
57

68
; Function Attrs: norecurse nounwind

llvm/test/CodeGen/Hexagon/loop-idiom/hexagon-memmove2.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -hexagon-loop-idiom -S -mtriple hexagon-unknown-elf < %s \
22
; RUN: | FileCheck %s
3+
; RUN: opt -p hexagon-loop-idiom -S -mtriple hexagon-unknown-elf < %s \
4+
; RUN: | FileCheck %s
35

46
define void @PR14241(ptr %s, i64 %size) #0 {
57
; Ensure that we don't form a memcpy for strided loops. Briefly, when we taught

llvm/test/CodeGen/Hexagon/loop-idiom/lcssa.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -hexagon-loop-idiom < %s | opt -S -passes='loop(loop-deletion),gvn'
1+
; RUN: opt -mtriple hexagon-- -S -passes='loop(hexagon-loop-idiom,loop-deletion),gvn'
22
; REQUIRES: asserts
33

44
; This tests that the HexagonLoopIdiom pass does not mark LCSSA information

llvm/test/CodeGen/Hexagon/loop-idiom/memmove-rt-check.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -hexagon-loop-idiom -S < %s | FileCheck %s
2+
; RUN: opt -p hexagon-loop-idiom -S < %s | FileCheck %s
23

34
; Make sure that we generate correct runtime checks.
45

llvm/test/CodeGen/Hexagon/loop-idiom/nullptr-crash.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -hexagon-loop-idiom -mtriple hexagon-unknown-elf < %s
2+
; RUN: opt -p hexagon-loop-idiom -mtriple hexagon-unknown-elf < %s
23
; REQUIRES: asserts
34

45
target triple = "hexagon"

llvm/test/CodeGen/Hexagon/loop-idiom/pmpy-infinite-loop.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -march=hexagon -hexagon-loop-idiom -S < %s | FileCheck %s
2+
; RUN: opt -march=hexagon -p hexagon-loop-idiom -S < %s | FileCheck %s
23
; CHECK-LABEL: define void @fred
34

45
; Check that this test does not crash.

llvm/test/CodeGen/Hexagon/loop-idiom/pmpy-long-loop.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -march=hexagon -hexagon-loop-idiom -S < %s | FileCheck %s
2+
; RUN: opt -march=hexagon -p hexagon-loop-idiom -S < %s | FileCheck %s
23
;
34
; The number of nested selects caused the simplification loop to take
45
; more than the maximum number of iterations. This caused the compiler

llvm/test/CodeGen/Hexagon/loop-idiom/pmpy-shiftconv-fail.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -march=hexagon -hexagon-loop-idiom -S < %s | FileCheck %s
2+
; RUN: opt -march=hexagon -p hexagon-loop-idiom -S < %s | FileCheck %s
23
; REQUIRES: asserts
34
;
45
; Check for sane output, this used to crash.

llvm/test/CodeGen/Hexagon/loop-idiom/pmpy.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -hexagon-loop-idiom < %s -mtriple=hexagon-unknown-unknown -S \
22
; RUN: | FileCheck %s
3+
; RUN: opt -p hexagon-loop-idiom < %s -mtriple=hexagon-unknown-unknown -S \
4+
; RUN: | FileCheck %s
35

46
target triple = "hexagon"
57

0 commit comments

Comments
 (0)