Looking for reviewer for one-line fix to sret handling in SelectionDAGISel::LowerArguments

I’d like to get another set of eyes to confirm.

In 2019, commit 9db00f7e “DAG: propagate whether an arg is a pointer for CallingConv decisions.” added the ‘IsPointer’ field to the ArgFlagsTy struct in TargetCallingConv.h.

This field is set in SelectionDAGBuilder, in the functions visitRet, LowerCallTo, and LowerArguments.

In LowerArguments particularly, the field is set when a formal argument has a pointer type. However, in the case that the function has an implicit SRet argument, there is no associated formal argument to inspect. Thus, SRet is handled in a block above the main loop.

https://github.com/llvm-mirror/llvm/blob/2c4ca6832fa6b306ee6a7010bfb80a3f2596f824/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp#L9565

In this case, the SRet argument is always a pointer (F.getReturnType()->getPointerTo(…)), but the pointer field of the ArgFlagsTy struct is not set.

A simple addition of “Flags.setPointer()” fixes the issue. My review with the change is posted at:

https://reviews.llvm.org/D105310

Regards,

J.B. Nagurne

Code Generation

Texas Instruments