[llvm] [VPlan] Extend licm to hoist replicate loads (PR #179506)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 09:48:02 PDT 2026
================
@@ -2695,7 +2723,9 @@ static void licm(VPlan &Plan) {
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
vp_depth_first_shallow(LoopRegion->getEntry()))) {
for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
- if (cannotHoistOrSinkRecipe(R))
+ if (cannotHoistOrSinkRecipe(R, LoadGroups,
+ LoopRegion->getEntryBasicBlock(),
+ LoopRegion->getExitingBasicBlock()))
----------------
artagnon wrote:
Ah, yes -- the corresponding check is hasLoopInvariantOperands, a helper we don't have:
```cpp
if (CurLoop->hasLoopInvariantOperands(&I) &&
canSinkOrHoistInst(I, AA, DT, CurLoop, MSSAU, true, Flags, ORE) &&
isSafeToExecuteUnconditionally(I, DT, TLI, CurLoop, SafetyInfo, ORE,
Preheader->getTerminator(), AC,
AllowSpeculation)) {
```
https://github.com/llvm/llvm-project/pull/179506
More information about the llvm-commits
mailing list