[llvm] [LV] Vectorize histogram operations (PR #99851)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 00:28:31 PDT 2024
================
@@ -390,6 +402,22 @@ class LoopVectorizationLegality {
unsigned getNumStores() const { return LAI->getNumStores(); }
unsigned getNumLoads() const { return LAI->getNumLoads(); }
+ /// Returns a HistogramInfo* for the given instruction if it was determined
+ /// to be part of a load -> update -> store sequence where multiple lanes
+ /// may be working on the same memory address.
+ std::optional<const HistogramInfo *> getHistogramInfo(Instruction *I) const {
+ for (const HistogramInfo &HGram : Histograms)
+ if (HGram.Load == I || HGram.Update == I || HGram.Store == I)
+ return &HGram;
+
+ return std::nullopt;
+ }
+
+ /// Returns a list of all known histogram operations in the loop.
+ const SmallVectorImpl<HistogramInfo> &getHistograms() const {
----------------
fhahn wrote:
looking at the users of this function, might be cleared to have `hasHistograms()` instead?
https://github.com/llvm/llvm-project/pull/99851
More information about the llvm-commits
mailing list