[llvm-dev] Looking for reviewer for one-line fix to sret handling in SelectionDAGISel::LowerArguments

Nagurne, James via llvm-dev llvm-dev at lists.llvm.org
Thu Jul 1 12:51:48 PDT 2021


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210701/b4b30620/attachment.html>


More information about the llvm-dev mailing list