Issue 179671
Summary [LV] `replicateByVF` attempts to remove recipes that still have users
Labels vectorizers
Assignees
Reporter MacDue
    The following IR:
```llvm
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-unknown-linux-gnu"

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.objectsize.i64.p0(ptr, i1 immarg, i1 immarg, i1 immarg) #0

; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none)
declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32) #1

define void @_ZN8kdu_core18kdu_cplex_analysis21allocate_record_blockEv(ptr align 8 dereferenceable(120) %0, i1 %1) {
  br label %3

3: ; preds = %17, %2
  %.0 = phi ptr [ null, %2 ], [ %6, %17 ]
  br i1 %1, label %5, label %4

4: ; preds = %3
  ret void

5: ; preds = %3
  %6 = getelementptr i8, ptr %.0, i64 128
 %7 = getelementptr i8, ptr %0, i64 24
  %8 = load ptr, ptr %7, align 8
 store ptr %8, ptr %.0, align 8
  %9 = call i64 @llvm.objectsize.i64.p0(ptr %0, i1 false, i1 false, i1 false)
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %10, label %11

10: ; preds = %5
  store volatile i32 0, ptr null, align 4
 unreachable

11:                                               ; preds = %5
  store ptr %.0, ptr %7, align 8
  %12 = getelementptr i8, ptr %0, i64 40
  %13 = load i32, ptr %12, align 8
  %14 = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %13, i32 1)
  %15 = extractvalue { i32, i1 } %14, 1
  br i1 %15, label %16, label %17

16: ; preds = %11
  store volatile i32 0, ptr null, align 4
 unreachable

17:                                               ; preds = %11
  %18 = extractvalue { i32, i1 } %14, 0
  store i32 %18, ptr %12, align 8
  br label %3
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }
```

When compiled with clang `-O2 --target=aarch64-unknown-linux-gnu  -c -o /dev/null`  leads to: `trying to delete a VPRecipeValue with remaining users` in `replicateByVF`.

See: https://godbolt.org/z/qbv5P9zv4

Reported by @joanahalili: https://github.com/llvm/llvm-project/pull/174835#issuecomment-3844233831
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to