1
- // ===-------- LoopIdiomTransform .cpp - Loop idiom recognition -------------===//
1
+ // ===-------- LoopIdiomVectorize .cpp - Loop idiom recognition -------------===//
2
2
//
3
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
4
// See https://llvm.org/LICENSE.txt for license information.
35
35
//
36
36
// ===----------------------------------------------------------------------===//
37
37
38
- #include " llvm/Transforms/Vectorize/LoopIdiomTransform .h"
38
+ #include " llvm/Transforms/Vectorize/LoopIdiomVectorize .h"
39
39
#include " llvm/ADT/ScopeExit.h"
40
40
#include " llvm/Analysis/DomTreeUpdater.h"
41
41
#include " llvm/Analysis/LoopPass.h"
50
50
using namespace llvm ;
51
51
using namespace PatternMatch ;
52
52
53
- #define DEBUG_TYPE " loop-idiom-transform "
53
+ #define DEBUG_TYPE " loop-idiom-vectorize "
54
54
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,
56
56
cl::init (false ),
57
57
cl::desc(" Disable Loop Idiom Transform Pass." ));
58
58
59
59
static cl::opt<bool >
60
- DisableByteCmp (" disable-loop-idiom-transform -bytecmp" , cl::Hidden,
60
+ DisableByteCmp (" disable-loop-idiom-vectorize -bytecmp" , cl::Hidden,
61
61
cl::init (false ),
62
62
cl::desc(" Proceed with Loop Idiom Transform Pass, but do "
63
63
" not convert byte-compare loop(s)." ));
64
64
65
65
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 ),
67
67
cl::desc(" Verify loops generated Loop Idiom Transform Pass." ));
68
68
69
69
namespace {
70
- class LoopIdiomTransform {
70
+ class LoopIdiomVectorize {
71
71
Loop *CurLoop = nullptr ;
72
72
DominatorTree *DT;
73
73
LoopInfo *LI;
@@ -82,7 +82,7 @@ class LoopIdiomTransform {
82
82
BasicBlock *VectorLoopIncBlock = nullptr ;
83
83
84
84
public:
85
- explicit LoopIdiomTransform (DominatorTree *DT, LoopInfo *LI,
85
+ explicit LoopIdiomVectorize (DominatorTree *DT, LoopInfo *LI,
86
86
const TargetTransformInfo *TTI,
87
87
const DataLayout *DL)
88
88
: DT(DT), LI(LI), TTI(TTI), DL(DL) {}
@@ -115,15 +115,15 @@ class LoopIdiomTransform {
115
115
};
116
116
} // anonymous namespace
117
117
118
- PreservedAnalyses LoopIdiomTransformPass ::run (Loop &L, LoopAnalysisManager &AM,
118
+ PreservedAnalyses LoopIdiomVectorizePass ::run (Loop &L, LoopAnalysisManager &AM,
119
119
LoopStandardAnalysisResults &AR,
120
120
LPMUpdater &) {
121
121
if (DisableAll)
122
122
return PreservedAnalyses::all ();
123
123
124
124
const auto *DL = &L.getHeader ()->getModule ()->getDataLayout ();
125
125
126
- LoopIdiomTransform LIT (&AR.DT , &AR.LI , &AR.TTI , DL);
126
+ LoopIdiomVectorize LIT (&AR.DT , &AR.LI , &AR.TTI , DL);
127
127
if (!LIT.run (&L))
128
128
return PreservedAnalyses::all ();
129
129
@@ -132,11 +132,11 @@ PreservedAnalyses LoopIdiomTransformPass::run(Loop &L, LoopAnalysisManager &AM,
132
132
133
133
// ===----------------------------------------------------------------------===//
134
134
//
135
- // Implementation of LoopIdiomTransform
135
+ // Implementation of LoopIdiomVectorize
136
136
//
137
137
// ===----------------------------------------------------------------------===//
138
138
139
- bool LoopIdiomTransform ::run (Loop *L) {
139
+ bool LoopIdiomVectorize ::run (Loop *L) {
140
140
CurLoop = L;
141
141
142
142
Function &F = *L->getHeader ()->getParent ();
@@ -160,7 +160,7 @@ bool LoopIdiomTransform::run(Loop *L) {
160
160
return recognizeByteCompare ();
161
161
}
162
162
163
- bool LoopIdiomTransform ::recognizeByteCompare () {
163
+ bool LoopIdiomVectorize ::recognizeByteCompare () {
164
164
// Currently the transformation only works on scalable vector types, although
165
165
// there is no fundamental reason why it cannot be made to work for fixed
166
166
// width too.
@@ -173,7 +173,7 @@ bool LoopIdiomTransform::recognizeByteCompare() {
173
173
174
174
BasicBlock *Header = CurLoop->getHeader ();
175
175
176
- // In LoopIdiomTransform ::run we have already checked that the loop
176
+ // In LoopIdiomVectorize ::run we have already checked that the loop
177
177
// has a preheader so we can assume it's in a canonical form.
178
178
if (CurLoop->getNumBackEdges () != 1 || CurLoop->getNumBlocks () != 2 )
179
179
return false ;
@@ -340,7 +340,7 @@ bool LoopIdiomTransform::recognizeByteCompare() {
340
340
return true ;
341
341
}
342
342
343
- Value *LoopIdiomTransform ::createMaskedFindMismatch (IRBuilder<> &Builder,
343
+ Value *LoopIdiomVectorize ::createMaskedFindMismatch (IRBuilder<> &Builder,
344
344
GetElementPtrInst *GEPA,
345
345
GetElementPtrInst *GEPB,
346
346
Value *ExtStart,
@@ -440,7 +440,7 @@ Value *LoopIdiomTransform::createMaskedFindMismatch(IRBuilder<> &Builder,
440
440
return Builder.CreateTrunc (VectorLoopRes64, ResType );
441
441
}
442
442
443
- Value *LoopIdiomTransform ::expandFindMismatch (
443
+ Value *LoopIdiomVectorize ::expandFindMismatch (
444
444
IRBuilder<> &Builder, DomTreeUpdater &DTU, GetElementPtrInst *GEPA,
445
445
GetElementPtrInst *GEPB, Instruction *Index, Value *Start, Value *MaxLen) {
446
446
Value *PtrA = GEPA->getPointerOperand ();
@@ -659,7 +659,7 @@ Value *LoopIdiomTransform::expandFindMismatch(
659
659
return FinalRes;
660
660
}
661
661
662
- void LoopIdiomTransform ::transformByteCompare (GetElementPtrInst *GEPA,
662
+ void LoopIdiomVectorize ::transformByteCompare (GetElementPtrInst *GEPA,
663
663
GetElementPtrInst *GEPB,
664
664
PHINode *IndPhi, Value *MaxLen,
665
665
Instruction *Index, Value *Start,
0 commit comments