[llvm] LV: Expand llvm.histogram intrinsic to support umax, umin, and uadd.sat operations (PR #127399)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 5 13:42:32 PDT 2026


================
@@ -5303,8 +5335,50 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
     return TTI.getCastInstrCost(Opcode, VectorTy, SrcVecTy, CCH,
                                 Config.CostKind, I);
   }
-  case Instruction::Call:
+  case Instruction::Call: {
+    // Check if this is a histogram update operation (intrinsic like uadd.sat,
+    // umax, umin used as histogram bucket update).
+    auto Info = Legal->getHistogramInfo(I);
+    if (Info && VF.isVector()) {
+      const HistogramInfo *HGram = Info.value();
----------------
fhahn wrote:

is this code needed/tested? it looks like all tests also pass without it

https://github.com/llvm/llvm-project/pull/127399


More information about the llvm-commits mailing list