diff options
Diffstat (limited to 'include/llvm/Transforms/Utils')
| -rw-r--r-- | include/llvm/Transforms/Utils/LoopUtils.h | 11 | ||||
| -rw-r--r-- | include/llvm/Transforms/Utils/OrderedInstructions.h | 2 | ||||
| -rw-r--r-- | include/llvm/Transforms/Utils/PredicateInfo.h | 18 | ||||
| -rw-r--r-- | include/llvm/Transforms/Utils/ValueMapper.h | 2 |
4 files changed, 19 insertions, 14 deletions
diff --git a/include/llvm/Transforms/Utils/LoopUtils.h b/include/llvm/Transforms/Utils/LoopUtils.h index 0397eb95e763..1344285917ba 100644 --- a/include/llvm/Transforms/Utils/LoopUtils.h +++ b/include/llvm/Transforms/Utils/LoopUtils.h @@ -184,9 +184,14 @@ public: /// Returns true if Phi is a first-order recurrence. A first-order recurrence /// is a non-reduction recurrence relation in which the value of the /// recurrence in the current loop iteration equals a value defined in the - /// previous iteration. - static bool isFirstOrderRecurrence(PHINode *Phi, Loop *TheLoop, - DominatorTree *DT); + /// previous iteration. \p SinkAfter includes pairs of instructions where the + /// first will be rescheduled to appear after the second if/when the loop is + /// vectorized. It may be augmented with additional pairs if needed in order + /// to handle Phi as a first-order recurrence. + static bool + isFirstOrderRecurrence(PHINode *Phi, Loop *TheLoop, + DenseMap<Instruction *, Instruction *> &SinkAfter, + DominatorTree *DT); RecurrenceKind getRecurrenceKind() { return Kind; } diff --git a/include/llvm/Transforms/Utils/OrderedInstructions.h b/include/llvm/Transforms/Utils/OrderedInstructions.h index 64c6bcb68b18..165d4bdaa6d4 100644 --- a/include/llvm/Transforms/Utils/OrderedInstructions.h +++ b/include/llvm/Transforms/Utils/OrderedInstructions.h @@ -46,7 +46,7 @@ public: /// i.e. If an instruction is deleted or added to the basic block, the user /// should call this function to invalidate the OrderedBasicBlock cache for /// this basic block. - void invalidateBlock(BasicBlock *BB) { OBBMap.erase(BB); } + void invalidateBlock(const BasicBlock *BB) { OBBMap.erase(BB); } }; } // end namespace llvm diff --git a/include/llvm/Transforms/Utils/PredicateInfo.h b/include/llvm/Transforms/Utils/PredicateInfo.h index 1322c686eb90..8150f1528397 100644 --- a/include/llvm/Transforms/Utils/PredicateInfo.h +++ b/include/llvm/Transforms/Utils/PredicateInfo.h @@ -74,6 +74,7 @@ #include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Transforms/Utils/OrderedInstructions.h" #include <algorithm> #include <cassert> #include <cstddef> @@ -89,7 +90,6 @@ class Instruction; class MemoryAccess; class LLVMContext; class raw_ostream; -class OrderedBasicBlock; enum PredicateType { PT_Branch, PT_Assume, PT_Switch }; @@ -114,8 +114,9 @@ protected: class PredicateWithCondition : public PredicateBase { public: Value *Condition; - static inline bool classof(const PredicateBase *PB) { - return PB->Type == PT_Assume || PB->Type == PT_Branch || PB->Type == PT_Switch; + static bool classof(const PredicateBase *PB) { + return PB->Type == PT_Assume || PB->Type == PT_Branch || + PB->Type == PT_Switch; } protected: @@ -133,7 +134,7 @@ public: : PredicateWithCondition(PT_Assume, Op, Condition), AssumeInst(AssumeInst) {} PredicateAssume() = delete; - static inline bool classof(const PredicateBase *PB) { + static bool classof(const PredicateBase *PB) { return PB->Type == PT_Assume; } }; @@ -146,7 +147,7 @@ public: BasicBlock *From; BasicBlock *To; PredicateWithEdge() = delete; - static inline bool classof(const PredicateBase *PB) { + static bool classof(const PredicateBase *PB) { return PB->Type == PT_Branch || PB->Type == PT_Switch; } @@ -166,7 +167,7 @@ public: : PredicateWithEdge(PT_Branch, Op, BranchBB, SplitBB, Condition), TrueEdge(TakenEdge) {} PredicateBranch() = delete; - static inline bool classof(const PredicateBase *PB) { + static bool classof(const PredicateBase *PB) { return PB->Type == PT_Branch; } }; @@ -182,7 +183,7 @@ public: SI->getCondition()), CaseValue(CaseValue), Switch(SI) {} PredicateSwitch() = delete; - static inline bool classof(const PredicateBase *PB) { + static bool classof(const PredicateBase *PB) { return PB->Type == PT_Switch; } }; @@ -244,6 +245,7 @@ private: Function &F; DominatorTree &DT; AssumptionCache &AC; + OrderedInstructions OI; // This maps from copy operands to Predicate Info. Note that it does not own // the Predicate Info, they belong to the ValueInfo structs in the ValueInfos // vector. @@ -256,8 +258,6 @@ private: // 0 is not a valid Value Info index, you can use DenseMap::lookup and tell // whether it returned a valid result. DenseMap<Value *, unsigned int> ValueInfoNums; - // OrderedBasicBlocks used during sorting uses - DenseMap<const BasicBlock *, std::unique_ptr<OrderedBasicBlock>> OBBMap; // The set of edges along which we can only handle phi uses, due to critical // edges. DenseSet<std::pair<BasicBlock *, BasicBlock *>> EdgeUsesOnly; diff --git a/include/llvm/Transforms/Utils/ValueMapper.h b/include/llvm/Transforms/Utils/ValueMapper.h index 0cc6b34d4593..45ef8246dcd1 100644 --- a/include/llvm/Transforms/Utils/ValueMapper.h +++ b/include/llvm/Transforms/Utils/ValueMapper.h @@ -116,7 +116,7 @@ static inline RemapFlags operator|(RemapFlags LHS, RemapFlags RHS) { /// - \a scheduleMapGlobalAliasee() /// - \a scheduleRemapFunction() /// -/// Sometimes a callback needs a diferent mapping context. Such a context can +/// Sometimes a callback needs a different mapping context. Such a context can /// be registered using \a registerAlternateMappingContext(), which takes an /// alternate \a ValueToValueMapTy and \a ValueMaterializer and returns a ID to /// pass into the schedule*() functions. |
