Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2174,12 +2174,13 @@ bool SILoadStoreOptimizer::promoteConstantOffsetToImm(

// Step1: Find the base-registers and a 64bit constant offset.
MachineOperand &Base = *TII->getNamedOperand(MI, AMDGPU::OpName::vaddr);
auto [It, Inserted] = Visited.try_emplace(&MI);
MemAddress MAddr;
if (!Visited.contains(&MI)) {
if (Inserted) {
processBaseWithConstOffset(Base, MAddr);
Visited[&MI] = MAddr;
It->second = MAddr;
} else
MAddr = Visited[&MI];
MAddr = It->second;

if (MAddr.Offset == 0) {
LLVM_DEBUG(dbgs() << " Failed to extract constant-offset or there are no"
Expand Down Expand Up @@ -2239,11 +2240,12 @@ bool SILoadStoreOptimizer::promoteConstantOffsetToImm(
const MachineOperand &BaseNext =
*TII->getNamedOperand(MINext, AMDGPU::OpName::vaddr);
MemAddress MAddrNext;
if (!Visited.contains(&MINext)) {
auto [It, Inserted] = Visited.try_emplace(&MINext);
if (Inserted) {
processBaseWithConstOffset(BaseNext, MAddrNext);
Visited[&MINext] = MAddrNext;
It->second = MAddrNext;
} else
MAddrNext = Visited[&MINext];
MAddrNext = It->second;

if (MAddrNext.Base.LoReg != MAddr.Base.LoReg ||
MAddrNext.Base.HiReg != MAddr.Base.HiReg ||
Expand Down