[llvm] [VPlan] Hoist predicated loads with complementary masks. (PR #168373)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 24 04:25:18 PST 2025


================
@@ -3974,6 +3974,152 @@ void VPlanTransforms::hoistInvariantLoads(VPlan &Plan) {
   }
 }
 
+// Returns the intersection of metadata from a group of loads.
+static VPIRMetadata getCommonLoadMetadata(ArrayRef<VPReplicateRecipe *> Loads) {
+  VPIRMetadata CommonMetadata = *Loads.front();
+  for (VPReplicateRecipe *Load : drop_begin(Loads))
+    CommonMetadata.intersect(*Load);
+  return CommonMetadata;
----------------
fhahn wrote:

I am not sure if that can be done generally without either requiring a template argument or creating a new vector with VPIRMetadata entries, as we cannot go from ArrayRef<VPReplicateRecipe *> -> ArrayRef<VPIRMetadata *> automatically at the moment I think

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


More information about the llvm-commits mailing list