[llvm] [VPlan] Extend licm to hoist assumes (PR #162636)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 14 08:32:34 PDT 2025
================
@@ -2095,6 +2106,15 @@ static void licm(VPlan &Plan) {
// out of a loop region. Does not address legality concerns such as aliasing
// or speculation safety.
auto CannotHoistRecipe = [](VPRecipeBase &R) {
+ // Assumes don't alias anything or throw.
+ if (match(&R, m_Intrinsic<Intrinsic::assume>()))
+ return false;
----------------
fhahn wrote:
this is the relevant change in the PR, right?
I think the key observation here why moving the assumes is safe is that we only process them if they are guaranteed to execute, right? Would be good to note.
It would be invalid to hoist an assume that only gets executed conditionally, even thoug it won't alias anything in the loop or throw.
https://github.com/llvm/llvm-project/pull/162636
More information about the llvm-commits
mailing list