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.


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:



J.B. Nagurne

Code Generation

Texas Instruments