Skip to content

Commit 15a9d34

Browse files
committed
[AMDGPU] Check tbuffer format before setMI
1 parent 8625df4 commit 15a9d34

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,6 +2378,19 @@ SILoadStoreOptimizer::collectMergeableInsts(
23782378
if (Swizzled != -1 && MI.getOperand(Swizzled).getImm())
23792379
continue;
23802380

2381+
if (InstClass == TBUFFER_LOAD || InstClass == TBUFFER_STORE) {
2382+
const MachineOperand *Fmt =
2383+
TII->getNamedOperand(MI, AMDGPU::OpName::format);
2384+
if (!Fmt) {
2385+
LLVM_DEBUG(dbgs() << "Skip tbuffer without format operand: " << MI);
2386+
continue;
2387+
}
2388+
if (!AMDGPU::getGcnBufferFormatInfo(Fmt->getImm(), *STM)) {
2389+
LLVM_DEBUG(dbgs() << "Skip tbuffer with unknown format: " << MI);
2390+
continue;
2391+
}
2392+
}
2393+
23812394
CombineInfo CI;
23822395
CI.setMI(MI, *this);
23832396
CI.Order = Order++;

0 commit comments

Comments
 (0)