================
@@ -935,25 +935,80 @@ propagateMemProfMetadata(Function *Callee, CallBase &CB,
   }
 }
 
-/// Collect all calls that produce RetVal, following only pointer-preserving
-/// instructions (cast, phi, select).
-static void collectPointerReturningCalls(Value *RetVal,
-                                         SmallVectorImpl<CallBase *> &Out) {
+/// Returns true for a {begin pointer, size} pair. This is the only span shape
+/// returned by malloc_span functions whose begin pointer is known from the
+/// type: a {pointer, pointer} pair may be in either order, and a span coerced
+/// by the ABI (e.g. to [2 x i64] on AArch64) has no pointer field at all, so
+/// those are only followed when returned as a whole.
+static bool isPointerSizeSpan(Type *Ty) {
----------------
melver wrote:

The inliner has no way to know the callee is a malloc_span function, so this
accepts any two-field struct of a pointer and an integer of any width:
{ptr, i32} for `struct { char *name; int flags; }`, {ptr, i1},
std::pair<T *, bool>. For a plain pointer wrapper,

    return find_or_insert(key).first;   // returns {ptr, i8}

now tags find_or_insert().

At minimum the integer should be pointer-sized (needs the DataLayout). But
the real issue is that a type shape is standing in for an attribute the IR
does not have; see the top-level comment.

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