[llvm] [AMDGPU][CodeGen] LocalStackSlotAllocation: record per-instr FI offsets (PR #166979)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 03:54:36 PST 2025
================
@@ -52,19 +52,23 @@ namespace {
MachineBasicBlock::iterator MI; // Instr referencing the frame
int64_t LocalOffset; // Local offset of the frame idx referenced
int FrameIdx; // The frame index
+ int64_t InstOffset; // Offset of the instruction from the base register
// Order reference instruction appears in program. Used to ensure
// deterministic order when multiple instructions may reference the same
// location.
unsigned Order;
public:
- FrameRef(MachineInstr *I, int64_t Offset, int Idx, unsigned Ord) :
- MI(I), LocalOffset(Offset), FrameIdx(Idx), Order(Ord) {}
+ FrameRef(MachineInstr *I, int64_t Offset, int Idx, int64_t InstOffset,
+ unsigned Ord)
+ : MI(I), LocalOffset(Offset), FrameIdx(Idx), InstOffset(InstOffset),
+ Order(Ord) {}
bool operator<(const FrameRef &RHS) const {
- return std::tie(LocalOffset, FrameIdx, Order) <
- std::tie(RHS.LocalOffset, RHS.FrameIdx, RHS.Order);
+ return std::make_tuple(LocalOffset + InstOffset, FrameIdx, Order) <
+ std::make_tuple(RHS.LocalOffset + RHS.InstOffset, RHS.FrameIdx,
----------------
jayfoad wrote:
Since C++17 you should not normally need make_tuple:
```suggestion
return std::tuple(LocalOffset + InstOffset, FrameIdx, Order) <
std::tuple(RHS.LocalOffset + RHS.InstOffset, RHS.FrameIdx,
```
https://github.com/llvm/llvm-project/pull/166979
More information about the llvm-commits
mailing list