This frees 2 scalar registers.
Details
Diff Detail
- Build Status
Buildable 1732 Build 1732: arc lint + arc unit
Event Timeline
lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | ||
---|---|---|
397–398 | There should be a query in SIMachineFunctionInfo to check if flat scratch will be used, because it's not even always required for hsa depending on the program. |
lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | ||
---|---|---|
397–398 | How to know if flat scratch will be used by HSA? Or can that be done in a later patch? |
lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | ||
---|---|---|
397–398 | I think the query should be added for this patch, but it can just return ST.hasHsaOS(). The smarter logic can be added in a later patch. |
hasStackObjects is a good enough approximation for now. Ideally it would be enabled only if it has an alloca that is addrspacecasted or has a captured private pointer. hasStackObjects would ideally only be alloca derived stack objects, not anything inserted by lowering (which should exist by the time reserved registers are frozen)
hasStackObjects doesn't say that scratch is accessed by flat instructions. The user may still want to use a buffer descriptor. Also, I wouldn't like to change the behavior for HSA in this patch (i.e. depend on hasStackObjects), because that needs lit tests adjustments and maybe even more tests.
That's why it's an approximation. If there are no stack objects, then obviously none are accessed through flat instructions. I don't think accessing the stack through a user buffer descriptor should be supported
There should be a query in SIMachineFunctionInfo to check if flat scratch will be used, because it's not even always required for hsa depending on the program.