[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
Wed Aug 26 23:54:26 PDT 2026
================
@@ -5852,3 +5822,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 ||
+ !isSafeToLoadUnconditionally(Underlying, LI.getType(), LI.getAlign(),
+ Plan.getDataLayout(), &LI,
+ /*AC=*/nullptr, /*DT=*/nullptr, &TLI))
----------------
arcbbb wrote:
On second thought, isDereferenceableAndAlignedPointer alone should be sufficient. And we don't need to suppress for sanitizers here since this only handles uniform access.
Updated!
https://github.com/llvm/llvm-project/pull/217564
More information about the llvm-commits
mailing list