[llvm] [VPlan] Handle more replicates in isUniformAcrossVFsAndUFs (PR #162342)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 08:24:49 PDT 2025


================
@@ -110,12 +110,7 @@ bool vputils::isUniformAcrossVFsAndUFs(VPValue *V) {
   return TypeSwitch<const VPRecipeBase *, bool>(R)
       .Case<VPDerivedIVRecipe>([](const auto *R) { return true; })
       .Case<VPReplicateRecipe>([](const auto *R) {
-        // Loads and stores that are uniform across VF lanes are handled by
-        // VPReplicateRecipe.IsUniform. They are also uniform across UF parts if
-        // all their operands are invariant.
-        // TODO: Further relax the restrictions.
         return R->isSingleScalar() &&
-               (isa<LoadInst, StoreInst>(R->getUnderlyingValue())) &&
----------------
fhahn wrote:

I think there are at least theoretical cases where all operands being uniform-across-VFs-and-UFs may not imply that the operation itself is as well. One example would be a single-scalar call to a function that increments a counter and returns its value. 

If the recipe has unknown side-effects, it is probably better to be conservative. Handling the known side-effects (mainly stores) and sideeffect-free should be sufficient to give handle the revelant cases in practice

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


More information about the llvm-commits mailing list