Removes the fatal error for sret arguments and adds lit testing.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/CodeGen/PowerPC/aix-sret-param.ll | ||
---|---|---|
37 | What is the cause of this alignment value? |
So it doesn't look like we need to add any special handling for struct returns on AIX? I had a quick look and none of the other PPC targets seem to have anything.
By the time we get the IR in this form from the front-end, we shouldn't need special handling here. We know the front-end does not represent complex types in an ideal way for AIX here.
We added the fatal_error in the previous patch in order to keep the patch as small and focused as possible. For back-end implementation everything should just work: we allocate a frame index for the object on the stack and pass a pointer to the frame-object as the argument. At that point its simply another pointer argument. As Hubert mentions though there is front-end (clang/CodeGen) work that is needed for generating the correct IR for AIX argument passing.
llvm/test/CodeGen/PowerPC/aix-sret-param.ll | ||
---|---|---|
37 | Frame object alignment smaller then 8 gets promoted ... but I'm not exactly sure why 8 as opposed to 4 or 16. I'll figure out where the 8 comes from. |
We added the fatal_error in the previous patch in order to keep the patch as small and focused as possible. For back-end implementation everything should just work: we allocate a frame index for the object on the stack and pass a pointer to the frame-object as the argument. At that point its simply another pointer argument. As Hubert mentions though there is front-end (clang/CodeGen) work that is needed for generating the correct IR for AIX argument passing.
I don't know what happens in the case where the front-end doesn't handle some cases correctly but the back-end does. Is there a danger in enabling this in the back-end knowing we don't get correct IR for complex types for AIX? Is there an error in the front-end for those before we get to this step?
llvm/test/CodeGen/PowerPC/aix-sret-param.ll | ||
---|---|---|
1–3 | Do we need '-verify-machineinstrs` in these tests? |
There's no error from the front-end. In terms of continuous delivery, this leads to silently bad code that could lead to incorrect output or crashes at runtime.
llvm/test/CodeGen/PowerPC/aix-sret-param.ll | ||
---|---|---|
1–3 | Yes, good call. | |
37 | When determining the alignment of the frame object we consider 3 different alignments and take the maximum of those. The three alignments are
So any alignment less then 8 will get promoted to 8 when creating the frame object. |
llvm/test/CodeGen/PowerPC/aix-sret-param.ll | ||
---|---|---|
37 | Got it. Thanks for looking into this. |
I think if the front-end AIX support was further along then a patch like this should be deferred until we fixed (and verified) the IR the front-end generates for sret arguments. With how clang/CodeGen is going through the SVR4 targets for AIX its safe to consider any Clang AIX support as extremely experimental right now, and the back-end implementation shouldn't be held up based on Clang support for the target.
llvm/test/CodeGen/PowerPC/aix-sret-param.ll | ||
---|---|---|
37 | np. |
@sfertile, I'm not seeing the change to the test to add -verify-machineinstrs. Perhaps you have a newer version to upload?
Do we need '-verify-machineinstrs` in these tests?