1//===----------LoopIdiomVectorize.h -----------------------------*- 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#ifndef LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H
10#define LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H
11
12#include "llvm/IR/PassManager.h"
13#include "llvm/Transforms/Scalar/LoopPassManager.h"
14
15namespace llvm {
16enum class LoopIdiomVectorizeStyle { Masked, Predicated };
17
18class LoopIdiomVectorizePass : public PassInfoMixin<LoopIdiomVectorizePass> {
19 LoopIdiomVectorizeStyle VectorizeStyle = LoopIdiomVectorizeStyle::Masked;
20
21 // The VF used in vectorizing the byte compare pattern.
22 unsigned ByteCompareVF = 16;
23
24public:
25 LoopIdiomVectorizePass() = default;
26 explicit LoopIdiomVectorizePass(LoopIdiomVectorizeStyle S)
27 : VectorizeStyle(S) {}
28
29 LoopIdiomVectorizePass(LoopIdiomVectorizeStyle S, unsigned BCVF)
30 : VectorizeStyle(S), ByteCompareVF(BCVF) {}
31
32 PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
33 LoopStandardAnalysisResults &AR, LPMUpdater &U);
34};
35} // namespace llvm
36#endif // LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H
37