From cb297050bb029b147e3c31c4efbd5887f9500f5d Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 24 Jan 2020 21:52:05 -0800 Subject: [PATCH] AMDGPU/SILoadStoreOptimizer: Fix uninitialized variable error This was introduced by 86c944d790728891801778b8d98c2c65a83f36a5 and caught by the sanitizer-x86_64-linux-fast bot. --- llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp b/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp index 364196b1d6e1..ee207586b0d0 100644 --- a/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp +++ b/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp @@ -510,6 +510,8 @@ void SILoadStoreOptimizer::CombineInfo::setMI(MachineBasicBlock::iterator MI, if (InstClass == MIMG) { DMask = TII.getNamedOperand(*I, AMDGPU::OpName::dmask)->getImm(); + // Offset is not considered for MIMG instructions. + Offset = 0; } else { int OffsetIdx = AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::offset); Offset = I->getOperand(OffsetIdx).getImm();