[llvm] [LV] Preserve GEP nusw when widening memory (PR #160885)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 03:22:48 PDT 2025


================
@@ -7482,12 +7482,11 @@ VPRecipeBuilder::tryToWidenMemory(Instruction *I, ArrayRef<VPValue *> Operands,
     VPSingleDefRecipe *VectorPtr;
     if (Reverse) {
       // When folding the tail, we may compute an address that we don't in the
-      // original scalar loop and it may not be inbounds. Drop Inbounds in that
-      // case.
+      // original scalar loop: drop the GEP no-wrap flags in this case.
----------------
fhahn wrote:

```suggestion
      // original scalar loop: drop the GEP no-wrap flags in this case. Otherwise preserve existing flags without no-unsigned-wrap, as we will emit negative indices.
```

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


More information about the llvm-commits mailing list