https://github.com/melver requested changes to this pull request.

1. The store tracing is flow-insensitive, and it applies to every wrapper,
   not only malloc_span ones. Any call ever stored to a local the returned
   value is loaded from now inherits the token, including calls that are
   overwritten or freed before the return. With
   -fsanitize-alloc-token-extended a tagged non-libfunc call is rewritten to
   the __alloc_token_ variant, so a wrong tag is not harmless.

2. "Span" is inferred from the IR type {ptr, iN}. The inliner cannot see the 
malloc_span attribute, so any function returning such a struct qualifies.

3. More generally this makes the inliner try to understand Clang's -O0 codegen 
(return  temporaries, coerced returns) by pattern matching. That is a small 
SROA  inside InlineFunction.cpp, and each further lowering (sret, memcpy'd 
temporaries, {begin, end}) will need another case.

Can we scope it down: whole-value returns only (drop the pointer-type filter), 
plus a single store that dominates the load, and leave field-wise 
reconstruction out.

Will that still work for the cases that you're trying to solve?

https://github.com/llvm/llvm-project/pull/244314
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to