[llvm] [VPlan] Lower safe uniform load to unconditional scalar load (Alt. approach) (PR #217564)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 05:10:08 PDT 2026
================
@@ -5852,3 +5823,36 @@ void VPlanTransforms::convertToStridedAccesses(VPlan &Plan,
}
}
}
+
+void VPlanTransforms::lowerSafeUniformLoads(VPlan &Plan,
+ const TargetLibraryInfo &TLI) {
+ for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
+ vp_depth_first_deep(Plan.getEntry()))) {
+ for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
+ auto *UniformGather = dyn_cast<VPWidenLoadRecipe>(&R);
+ if (!UniformGather ||
+ !vputils::isUniformAcrossVFsAndUFs(UniformGather->getAddr()))
+ continue;
+
+ auto &LI = cast<LoadInst>(UniformGather->getIngredient());
+ VPValue *Addr = UniformGather->getAddr();
+ Value *Underlying = Addr->getUnderlyingValue();
+ if (!Underlying ||
+ !isDereferenceableAndAlignedPointer(
+ Underlying, LI.getType(), LI.getAlign(),
+ SimplifyQuery(Plan.getDataLayout(), &TLI, /*DT=*/nullptr,
+ /*AC=*/nullptr, &LI)))
----------------
arcbbb wrote:
I added a test case that exercises the TLI path.
https://github.com/llvm/llvm-project/pull/217564
More information about the llvm-commits
mailing list