[PATCH] D144699: [llvm][Uniformity] provide overloads for Instruction* and Value*

Sameer Sahasrabuddhe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 21:59:54 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3e03cd87b876: [llvm][Uniformity] provide overloads for Instruction* and Value* (authored by sameerds).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144699/new/

https://reviews.llvm.org/D144699

Files:
  llvm/include/llvm/ADT/GenericUniformityImpl.h
  llvm/include/llvm/ADT/GenericUniformityInfo.h


Index: llvm/include/llvm/ADT/GenericUniformityInfo.h
===================================================================
--- llvm/include/llvm/ADT/GenericUniformityInfo.h
+++ llvm/include/llvm/ADT/GenericUniformityInfo.h
@@ -62,6 +62,13 @@
   /// Whether \p V is uniform/non-divergent.
   bool isUniform(ConstValueRefT V) const { return !isDivergent(V); }
 
+  // Similar queries for InstructionT. These accept a pointer argument so that
+  // in LLVM IR, they overload the equivalent queries for Value*. For example,
+  // if querying whether a BranchInst is divergent, it should not be treated as
+  // a Value in LLVM IR.
+  bool isUniform(const InstructionT *I) const { return !isDivergent(I); };
+  bool isDivergent(const InstructionT *I) const;
+
   bool hasDivergentTerminator(const BlockT &B);
 
   void print(raw_ostream &Out) const;
Index: llvm/include/llvm/ADT/GenericUniformityImpl.h
===================================================================
--- llvm/include/llvm/ADT/GenericUniformityImpl.h
+++ llvm/include/llvm/ADT/GenericUniformityImpl.h
@@ -1264,6 +1264,11 @@
   return DA->isDivergent(V);
 }
 
+template <typename ContextT>
+bool GenericUniformityInfo<ContextT>::isDivergent(const InstructionT *I) const {
+  return DA->isDivergent(*I);
+}
+
 template <typename ContextT>
 bool GenericUniformityInfo<ContextT>::hasDivergentTerminator(const BlockT &B) {
   return DA->hasDivergentTerminator(B);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144699.501030.patch
Type: text/x-patch
Size: 1422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230228/5cedef4e/attachment.bin>


More information about the llvm-commits mailing list