Patch to do return address lowering.
Details
Diff Detail
Event Timeline
lib/Target/AMDGPU/AMDGPUISelLowering.cpp | ||
---|---|---|
2793–2795 | verifyReturnAddressArgumentIsConstant should probably be removed in a separate patch. The verifier now rejects the IR, and the DAG should never be allowed to produce an invalid one | |
2799–2801 | Unnecessary comment | |
2807–2810 | This should not be an assert. According to the spec, this could just return 0 for another frame id | |
2815 | Should use TRI::getReturnAddressReg rather than hardcoding it in another place. You can just hardcode the register class though | |
test/CodeGen/AMDGPU/returnaddress.ll | ||
1 | Should use HSA triple | |
9 | Use named values | |
12 | Needs test with non-0 frame |
Commit message should also say it's lowering returnaddress, not mention instrument-functions
test/CodeGen/AMDGPU/returnaddress.ll | ||
---|---|---|
7 | Needs a test with amdgpu_kernel and shaders. As is this will fail as they don’t have return addresses |
lib/Target/AMDGPU/SIISelLowering.cpp | ||
---|---|---|
4156 ↗ | (On Diff #198542) | Formatting |
4159–4161 ↗ | (On Diff #198542) | This can just give 0 instead of erring |
4168 ↗ | (On Diff #198542) | This still won't handle kernels correctly |
test/CodeGen/AMDGPU/returnaddress.ll | ||
20 | Needs tests with a kernel and shader, since this should crash as is since there is no return address |
lib/Target/AMDGPU/AMDGPUISelLowering.cpp | ||
---|---|---|
29 | Not sure why you need a new include here |
Mostly LGTM, but 2 more test cases might be useful; one with no ret, and one with the use outside of the entry block
Added a test outside entry block; doesn't make any difference in the output.
By a test with no ret, do you mean something that returns void?
No, I mean ends in unreachable
test/CodeGen/AMDGPU/returnaddress.ll | ||
---|---|---|
48–50 | This is still in the entry block |
Fixed two tests; one which does not return and another with use outside of the entry block.
returnadr.diff | ||
---|---|---|
2 ↗ | (On Diff #201329) | You somehow added the diff as a file |
105 ↗ | (On Diff #201329) | The call is still in the entry block. You should also make it a conditional branch to make sure nothing folds it |
test/CodeGen/AMDGPU/returnaddress.ll | ||
43–44 | The call is still in the entry block. You should also make it a conditional branch to make sure nothing folds it |
verifyReturnAddressArgumentIsConstant should probably be removed in a separate patch. The verifier now rejects the IR, and the DAG should never be allowed to produce an invalid one