[llvm] [AMDGPU] Use immediates for stack accesses in chain funcs (PR #71913)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 00:55:40 PST 2023


================
@@ -1799,10 +1798,11 @@ static bool frameTriviallyRequiresSP(const MachineFrameInfo &MFI) {
 bool SIFrameLowering::hasFP(const MachineFunction &MF) const {
   const MachineFrameInfo &MFI = MF.getFrameInfo();
 
-  // For entry functions we can use an immediate offset in most cases, so the
-  // presence of calls doesn't imply we need a distinct frame pointer.
+  // For entry & chain functions we can use an immediate offset in most cases,
+  // so the presence of calls doesn't imply we need a distinct frame pointer.
   if (MFI.hasCalls() &&
-      !MF.getInfo<SIMachineFunctionInfo>()->isEntryFunction()) {
+      !MF.getInfo<SIMachineFunctionInfo>()->isEntryFunction() &&
+      !MF.getInfo<SIMachineFunctionInfo>()->isChainFunction()) {
----------------
rovka wrote:

Ok, thanks, I'll think some more about the name. My brain's first reaction to this one was "what's a stack function and why would something be the bottom of it?" (it makes sense when compared to the existing helpers, but on its own it sounds a bit off).

Also IMO we have potential for a lot of confusion just with the existing `isShader`, `isEntryFunction` and `isModuleEntryFunction`, and it wouldn't help to introduce more of this kind of vague terminology (unless we explain it properly in the comments, which I'm a bit shy to do myself for the existing helpers). It would be nice to separate the different aspects of "entry"-ness into helpers with more expressive names, but I don't have a very good idea about how to go about that. </rant>


https://github.com/llvm/llvm-project/pull/71913


More information about the llvm-commits mailing list