[llvm] [VPlan] Simplify ExplicitVectorLength(%AVL) -> %AVL when AVL <= VF (PR #167647)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 12 05:19:29 PST 2025


================
@@ -1274,6 +1259,7 @@ bool VPInstruction::opcodeMayReadOrWriteFromMemory() const {
   case VPInstruction::ExtractLastLanePerPart:
   case VPInstruction::ExtractPenultimateElement:
   case VPInstruction::ActiveLaneMask:
+  case VPInstruction::ExplicitVectorLength:
----------------
lukel97 wrote:

simplifyKnownEVL will now call replaceAllUsesWith on the old ExplicitVectorLength recipe so it's dead. However removeDeadRecipes previously wouldn't have removed it because opcodeMayReadOrWriteFromMemory returned true, so mayHaveSideEffects returned true and thus isDeadRecipe returned false. 

This is what's needed to remove the `@llvm.experimental.get.vector.length.i64(i64 16, i32 8, i1 true)` in the test diff

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


More information about the llvm-commits mailing list