Skip to content

Commit ef0f844

Browse files
tgymnichshiltian
authored andcommitted
[AMDGPU] add missing checks in processBaseWithConstOffset (llvm#102310)
fixes llvm#102231 by inserting missing checks. (cherry picked from commit 273e0a4)
1 parent a84753e commit ef0f844

File tree

3 files changed

+250
-130
lines changed

3 files changed

+250
-130
lines changed

llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,9 @@ void SILoadStoreOptimizer::processBaseWithConstOffset(const MachineOperand &Base
20412041
BaseLo = *Src0;
20422042
}
20432043

2044+
if (!BaseLo.isReg())
2045+
return;
2046+
20442047
Src0 = TII->getNamedOperand(*BaseHiDef, AMDGPU::OpName::src0);
20452048
Src1 = TII->getNamedOperand(*BaseHiDef, AMDGPU::OpName::src1);
20462049

@@ -2053,6 +2056,9 @@ void SILoadStoreOptimizer::processBaseWithConstOffset(const MachineOperand &Base
20532056
uint64_t Offset1 = Src1->getImm();
20542057
BaseHi = *Src0;
20552058

2059+
if (!BaseHi.isReg())
2060+
return;
2061+
20562062
Addr.Base.LoReg = BaseLo.getReg();
20572063
Addr.Base.HiReg = BaseHi.getReg();
20582064
Addr.Base.LoSubReg = BaseLo.getSubReg();

0 commit comments

Comments
 (0)