[ASan] Make insertion of version mismatch guard configurable
[llvm-core.git] / lib / Transforms / Vectorize / VPlanPredicator.h
blob692afd2978d5300849fc1ebf3097840319174ad9
1 //===-- VPlanPredicator.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 /// \file
10 /// This file defines the VPlanPredicator class which contains the public
11 /// interfaces to predicate and linearize the VPlan region.
12 ///
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_PREDICATOR_H
16 #define LLVM_TRANSFORMS_VECTORIZE_VPLAN_PREDICATOR_H
18 #include "LoopVectorizationPlanner.h"
19 #include "VPlan.h"
20 #include "VPlanDominatorTree.h"
22 namespace llvm {
24 class VPlanPredicator {
25 private:
26 enum class EdgeType {
27 TRUE_EDGE,
28 FALSE_EDGE,
31 // VPlan being predicated.
32 VPlan &Plan;
34 // VPLoopInfo for Plan's HCFG.
35 VPLoopInfo *VPLI;
37 // Dominator tree for Plan's HCFG.
38 VPDominatorTree VPDomTree;
40 // VPlan builder used to generate VPInstructions for block predicates.
41 VPBuilder Builder;
43 /// Get the type of edge from \p FromBlock to \p ToBlock. Returns TRUE_EDGE if
44 /// \p ToBlock is either the unconditional successor or the conditional true
45 /// successor of \p FromBlock and FALSE_EDGE otherwise.
46 EdgeType getEdgeTypeBetween(VPBlockBase *FromBlock, VPBlockBase *ToBlock);
48 /// Create and return VPValue corresponding to the predicate for the edge from
49 /// \p PredBB to \p CurrentBlock.
50 VPValue *getOrCreateNotPredicate(VPBasicBlock *PredBB, VPBasicBlock *CurrBB);
52 /// Generate and return the result of ORing all the predicate VPValues in \p
53 /// Worklist.
54 VPValue *genPredicateTree(std::list<VPValue *> &Worklist);
56 /// Create or propagate predicate for \p CurrBlock in region \p Region using
57 /// predicate(s) of its predecessor(s)
58 void createOrPropagatePredicates(VPBlockBase *CurrBlock,
59 VPRegionBlock *Region);
61 /// Predicate the CFG within \p Region.
62 void predicateRegionRec(VPRegionBlock *Region);
64 /// Linearize the CFG within \p Region.
65 void linearizeRegionRec(VPRegionBlock *Region);
67 public:
68 VPlanPredicator(VPlan &Plan);
70 /// Predicate Plan's HCFG.
71 void predicate(void);
73 } // end namespace llvm
74 #endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_PREDICATOR_H