5151#include " llvm/ADT/SmallPtrSet.h"
5252#include " llvm/ADT/SparseBitVector.h"
5353#include " llvm/ADT/StringExtras.h"
54+ #include " llvm/ADT/Uniformity.h"
5455#include " llvm/Support/raw_ostream.h"
5556
5657#define DEBUG_TYPE " uniformity"
@@ -407,6 +408,11 @@ template <typename ContextT> class GenericUniformityAnalysisImpl {
407408 void recordTemporalDivergence (ConstValueRefT, const InstructionT *,
408409 const CycleT *);
409410
411+ bool isAnyOperandUniform (const InstructionT &Instr) const ;
412+
413+ // / \brief keep track of special target intrinsics that can be proven uniform.
414+ void addSpecialUniformIntrinsic (const InstructionT &Instr);
415+
410416protected:
411417 // / \brief Value/block pair representing a single phi input.
412418 struct PhiInput {
@@ -429,6 +435,8 @@ template <typename ContextT> class GenericUniformityAnalysisImpl {
429435 // Internal worklist for divergence propagation.
430436 std::vector<const InstructionT *> Worklist;
431437
438+ // Special intrinsics list which can be proven uniform.
439+ llvm::SmallPtrSet<const InstructionT *, 8 > SpecialUniformIntrinsics;
432440 // / \brief Mark \p Term as divergent and push all Instructions that become
433441 // / divergent as a result on the worklist.
434442 void analyzeControlDivergence (const InstructionT &Term);
@@ -824,6 +832,12 @@ void GenericUniformityAnalysisImpl<ContextT>::addUniformOverride(
824832 UniformOverrides.insert (&Instr);
825833}
826834
835+ template <typename ContextT>
836+ void GenericUniformityAnalysisImpl<ContextT>::addSpecialUniformIntrinsic(
837+ const InstructionT &Instr) {
838+ SpecialUniformIntrinsics.insert (&Instr);
839+ }
840+
827841// Mark as divergent all external uses of values defined in \p DefCycle.
828842//
829843// A value V defined by a block B inside \p DefCycle may be used outside the
0 commit comments