Context:
I'm not sure whether this is a bug or I'm not understanding what Enzyme is warning me about, so some information on possible sources of the error would be really appreciated. The error message is freeing without malloc, but inspecting the IR it looks to me like the pointer being freed was clearly allocated in all ancestors.
Issue:
Specifically, Enzyme produces this warning in connection with a PHI node:
Both operands %first and %second are allocated with a custom allocation function _mlir_memref_to_llvm_alloc, and the result is freed with _mlir_memref_to_llvm_free. See full snippet below.
One thing I noticed is without the llvm.memcpy.p0.p0.i64 call the error does not reproduce.
Reproducer:
This snippet was generated with llvm-reduce but I think it still preserves the core issue:
Context: I'm not sure whether this is a bug or I'm not understanding what Enzyme is warning me about, so some information on possible sources of the error would be really appreciated. The error message is
freeing without malloc
, but inspecting the IR it looks to me like the pointer being freed was clearly allocated in all ancestors.Issue: Specifically, Enzyme produces this warning in connection with a PHI node:
Both operands
%first
and%second
are allocated with a custom allocation function_mlir_memref_to_llvm_alloc
, and the result is freed with_mlir_memref_to_llvm_free
. See full snippet below.One thing I noticed is without the
llvm.memcpy.p0.p0.i64
call the error does not reproduce.Reproducer: This snippet was generated with
llvm-reduce
but I think it still preserves the core issue:Versions: llvm=3a8316216807d64a586b971f51695e23883331f7 enzyme=v0.0.130