Skip to content

Commit 94bba11

Browse files
committed
Rename LoopIdiomTransform to LoopIdiomVectorize
1 parent e6b8edc commit 94bba11

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
//===----------LoopIdiomTransform.h -----------------------------*- C++ -*-===//
1+
//===----------LoopIdiomVectorize.h -----------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMTRANSFORM_H
10-
#define LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMTRANSFORM_H
9+
#ifndef LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H
10+
#define LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H
1111

1212
#include "llvm/IR/PassManager.h"
1313
#include "llvm/Transforms/Scalar/LoopPassManager.h"
1414

1515
namespace llvm {
16-
struct LoopIdiomTransformPass : PassInfoMixin<LoopIdiomTransformPass> {
16+
struct LoopIdiomVectorizePass : PassInfoMixin<LoopIdiomVectorizePass> {
1717
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
1818
LoopStandardAnalysisResults &AR, LPMUpdater &U);
1919
};
2020
} // namespace llvm
21-
#endif // LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMTRANSFORM_H
21+
#endif // LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@
297297
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
298298
#include "llvm/Transforms/Utils/UnifyLoopExits.h"
299299
#include "llvm/Transforms/Vectorize/LoadStoreVectorizer.h"
300-
#include "llvm/Transforms/Vectorize/LoopIdiomTransform.h"
300+
#include "llvm/Transforms/Vectorize/LoopIdiomVectorize.h"
301301
#include "llvm/Transforms/Vectorize/LoopVectorize.h"
302302
#include "llvm/Transforms/Vectorize/SLPVectorizer.h"
303303
#include "llvm/Transforms/Vectorize/VectorCombine.h"

llvm/lib/Passes/PassRegistry.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ LOOP_PASS("invalidate<all>", InvalidateAllAnalysesPass())
621621
LOOP_PASS("loop-bound-split", LoopBoundSplitPass())
622622
LOOP_PASS("loop-deletion", LoopDeletionPass())
623623
LOOP_PASS("loop-idiom", LoopIdiomRecognizePass())
624-
LOOP_PASS("loop-idiom-transform", LoopIdiomTransformPass())
624+
LOOP_PASS("loop-idiom-vectorize", LoopIdiomVectorizePass())
625625
LOOP_PASS("loop-instsimplify", LoopInstSimplifyPass())
626626
LOOP_PASS("loop-predication", LoopPredicationPass())
627627
LOOP_PASS("loop-reduce", LoopStrengthReducePass())

llvm/lib/Target/AArch64/AArch64TargetMachine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#include "llvm/TargetParser/Triple.h"
5252
#include "llvm/Transforms/CFGuard.h"
5353
#include "llvm/Transforms/Scalar.h"
54-
#include "llvm/Transforms/Vectorize/LoopIdiomTransform.h"
54+
#include "llvm/Transforms/Vectorize/LoopIdiomVectorize.h"
5555
#include <memory>
5656
#include <optional>
5757
#include <string>
@@ -554,7 +554,7 @@ void AArch64TargetMachine::registerPassBuilderCallbacks(
554554

555555
PB.registerLateLoopOptimizationsEPCallback(
556556
[=](LoopPassManager &LPM, OptimizationLevel Level) {
557-
LPM.addPass(LoopIdiomTransformPass());
557+
LPM.addPass(LoopIdiomVectorizePass());
558558
});
559559
}
560560

llvm/lib/Transforms/Vectorize/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
add_llvm_component_library(LLVMVectorize
22
LoadStoreVectorizer.cpp
3-
LoopIdiomTransform.cpp
3+
LoopIdiomVectorize.cpp
44
LoopVectorizationLegality.cpp
55
LoopVectorize.cpp
66
SLPVectorizer.cpp

llvm/lib/Transforms/Vectorize/LoopIdiomTransform.cpp renamed to llvm/lib/Transforms/Vectorize/LoopIdiomVectorize.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-------- LoopIdiomTransform.cpp - Loop idiom recognition -------------===//
1+
//===-------- LoopIdiomVectorize.cpp - Loop idiom recognition -------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -35,7 +35,7 @@
3535
//
3636
//===----------------------------------------------------------------------===//
3737

38-
#include "llvm/Transforms/Vectorize/LoopIdiomTransform.h"
38+
#include "llvm/Transforms/Vectorize/LoopIdiomVectorize.h"
3939
#include "llvm/ADT/ScopeExit.h"
4040
#include "llvm/Analysis/DomTreeUpdater.h"
4141
#include "llvm/Analysis/LoopPass.h"
@@ -50,24 +50,24 @@
5050
using namespace llvm;
5151
using namespace PatternMatch;
5252

53-
#define DEBUG_TYPE "loop-idiom-transform"
53+
#define DEBUG_TYPE "loop-idiom-vectorize"
5454

55-
static cl::opt<bool> DisableAll("disable-loop-idiom-transform-all", cl::Hidden,
55+
static cl::opt<bool> DisableAll("disable-loop-idiom-vectorize-all", cl::Hidden,
5656
cl::init(false),
5757
cl::desc("Disable Loop Idiom Transform Pass."));
5858

5959
static cl::opt<bool>
60-
DisableByteCmp("disable-loop-idiom-transform-bytecmp", cl::Hidden,
60+
DisableByteCmp("disable-loop-idiom-vectorize-bytecmp", cl::Hidden,
6161
cl::init(false),
6262
cl::desc("Proceed with Loop Idiom Transform Pass, but do "
6363
"not convert byte-compare loop(s)."));
6464

6565
static cl::opt<bool>
66-
VerifyLoops("verify-loop-idiom-transform", cl::Hidden, cl::init(false),
66+
VerifyLoops("verify-loop-idiom-vectorize", cl::Hidden, cl::init(false),
6767
cl::desc("Verify loops generated Loop Idiom Transform Pass."));
6868

6969
namespace {
70-
class LoopIdiomTransform {
70+
class LoopIdiomVectorize {
7171
Loop *CurLoop = nullptr;
7272
DominatorTree *DT;
7373
LoopInfo *LI;
@@ -82,7 +82,7 @@ class LoopIdiomTransform {
8282
BasicBlock *VectorLoopIncBlock = nullptr;
8383

8484
public:
85-
explicit LoopIdiomTransform(DominatorTree *DT, LoopInfo *LI,
85+
explicit LoopIdiomVectorize(DominatorTree *DT, LoopInfo *LI,
8686
const TargetTransformInfo *TTI,
8787
const DataLayout *DL)
8888
: DT(DT), LI(LI), TTI(TTI), DL(DL) {}
@@ -115,15 +115,15 @@ class LoopIdiomTransform {
115115
};
116116
} // anonymous namespace
117117

118-
PreservedAnalyses LoopIdiomTransformPass::run(Loop &L, LoopAnalysisManager &AM,
118+
PreservedAnalyses LoopIdiomVectorizePass::run(Loop &L, LoopAnalysisManager &AM,
119119
LoopStandardAnalysisResults &AR,
120120
LPMUpdater &) {
121121
if (DisableAll)
122122
return PreservedAnalyses::all();
123123

124124
const auto *DL = &L.getHeader()->getModule()->getDataLayout();
125125

126-
LoopIdiomTransform LIT(&AR.DT, &AR.LI, &AR.TTI, DL);
126+
LoopIdiomVectorize LIT(&AR.DT, &AR.LI, &AR.TTI, DL);
127127
if (!LIT.run(&L))
128128
return PreservedAnalyses::all();
129129

@@ -132,11 +132,11 @@ PreservedAnalyses LoopIdiomTransformPass::run(Loop &L, LoopAnalysisManager &AM,
132132

133133
//===----------------------------------------------------------------------===//
134134
//
135-
// Implementation of LoopIdiomTransform
135+
// Implementation of LoopIdiomVectorize
136136
//
137137
//===----------------------------------------------------------------------===//
138138

139-
bool LoopIdiomTransform::run(Loop *L) {
139+
bool LoopIdiomVectorize::run(Loop *L) {
140140
CurLoop = L;
141141

142142
Function &F = *L->getHeader()->getParent();
@@ -160,7 +160,7 @@ bool LoopIdiomTransform::run(Loop *L) {
160160
return recognizeByteCompare();
161161
}
162162

163-
bool LoopIdiomTransform::recognizeByteCompare() {
163+
bool LoopIdiomVectorize::recognizeByteCompare() {
164164
// Currently the transformation only works on scalable vector types, although
165165
// there is no fundamental reason why it cannot be made to work for fixed
166166
// width too.
@@ -173,7 +173,7 @@ bool LoopIdiomTransform::recognizeByteCompare() {
173173

174174
BasicBlock *Header = CurLoop->getHeader();
175175

176-
// In LoopIdiomTransform::run we have already checked that the loop
176+
// In LoopIdiomVectorize::run we have already checked that the loop
177177
// has a preheader so we can assume it's in a canonical form.
178178
if (CurLoop->getNumBackEdges() != 1 || CurLoop->getNumBlocks() != 2)
179179
return false;
@@ -340,7 +340,7 @@ bool LoopIdiomTransform::recognizeByteCompare() {
340340
return true;
341341
}
342342

343-
Value *LoopIdiomTransform::createMaskedFindMismatch(IRBuilder<> &Builder,
343+
Value *LoopIdiomVectorize::createMaskedFindMismatch(IRBuilder<> &Builder,
344344
GetElementPtrInst *GEPA,
345345
GetElementPtrInst *GEPB,
346346
Value *ExtStart,
@@ -440,7 +440,7 @@ Value *LoopIdiomTransform::createMaskedFindMismatch(IRBuilder<> &Builder,
440440
return Builder.CreateTrunc(VectorLoopRes64, ResType);
441441
}
442442

443-
Value *LoopIdiomTransform::expandFindMismatch(
443+
Value *LoopIdiomVectorize::expandFindMismatch(
444444
IRBuilder<> &Builder, DomTreeUpdater &DTU, GetElementPtrInst *GEPA,
445445
GetElementPtrInst *GEPB, Instruction *Index, Value *Start, Value *MaxLen) {
446446
Value *PtrA = GEPA->getPointerOperand();
@@ -659,7 +659,7 @@ Value *LoopIdiomTransform::expandFindMismatch(
659659
return FinalRes;
660660
}
661661

662-
void LoopIdiomTransform::transformByteCompare(GetElementPtrInst *GEPA,
662+
void LoopIdiomVectorize::transformByteCompare(GetElementPtrInst *GEPA,
663663
GetElementPtrInst *GEPB,
664664
PHINode *IndPhi, Value *MaxLen,
665665
Instruction *Index, Value *Start,

llvm/test/Transforms/LoopIdiom/AArch64/byte-compare-index.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2-
; RUN: opt -p loop-idiom-transform -verify-loop-idiom-transform -verify-dom-info -mtriple aarch64-unknown-linux-gnu -mattr=+sve -S < %s | FileCheck %s
3-
; RUN: opt -passes='function(loop(loop-idiom-transform)),simplifycfg' -mtriple aarch64-unknown-linux-gnu -mattr=+sve -S < %s | FileCheck %s --check-prefix=LOOP-DEL
4-
; RUN: opt -p loop-idiom-transform -mtriple aarch64-unknown-linux-gnu -S < %s | FileCheck %s --check-prefix=NO-TRANSFORM
2+
; RUN: opt -p loop-idiom-vectorize -verify-loop-idiom-vectorize -verify-dom-info -mtriple aarch64-unknown-linux-gnu -mattr=+sve -S < %s | FileCheck %s
3+
; RUN: opt -passes='function(loop(loop-idiom-vectorize)),simplifycfg' -mtriple aarch64-unknown-linux-gnu -mattr=+sve -S < %s | FileCheck %s --check-prefix=LOOP-DEL
4+
; RUN: opt -p loop-idiom-vectorize -mtriple aarch64-unknown-linux-gnu -S < %s | FileCheck %s --check-prefix=NO-TRANSFORM
55

66
define i32 @compare_bytes_simple(ptr %a, ptr %b, i32 %len, i32 %extra, i32 %n) {
77
; CHECK-LABEL: define i32 @compare_bytes_simple(

0 commit comments

Comments
 (0)