Patch to do return address lowering.
Details
Diff Detail
Event Timeline
lib/Target/AMDGPU/AMDGPUISelLowering.cpp | ||
---|---|---|
2793–2795 ↗ | (On Diff #191776) | 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 ↗ | (On Diff #191776) | Unnecessary comment |
2807–2810 ↗ | (On Diff #191776) | This should not be an assert. According to the spec, this could just return 0 for another frame id |
2815 ↗ | (On Diff #191776) | Should use TRI::getReturnAddressReg rather than hardcoding it in another place. You can just hardcode the register class though |
test/CodeGen/AMDGPU/returnaddress.ll | ||
2 | Should use HSA triple | |
10 | Use named values | |
13 | Needs test with non-0 frame |
Commit message should also say it's lowering returnaddress, not mention instrument-functions
test/CodeGen/AMDGPU/returnaddress.ll | ||
---|---|---|
8 | Needs a test with amdgpu_kernel and shaders. As is this will fail as they don’t have return addresses |
lib/Target/AMDGPU/AMDGPUISelLowering.cpp | ||
---|---|---|
29 ↗ | (On Diff #198542) | 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 | You somehow added the diff as a file | |
105 | 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 | ||
42–43 | The call is still in the entry block. You should also make it a conditional branch to make sure nothing folds it |
Formatting