AMDGPU/SILoadStoreOptimizer: fix a likely bug introduced recently
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 9 Oct 2019 10:53:17 +0000 (12:53 +0200)
committerNicolai Hähnle <nhaehnle@gmail.com>
Sat, 16 Nov 2019 10:35:34 +0000 (11:35 +0100)
commitd8f7c68e28bd0b8eb49f752bd7d26aa767c0b078
tree7b5cb592b5b36adcae5a0fa546abe46f94fe6948
parentcf6cf0cd147ac2524c3533fd7c7ada7f95f6da60
AMDGPU/SILoadStoreOptimizer: fix a likely bug introduced recently

Summary:
We should check for same instruction class before checking whether they
have the same base address, else we might iterate out of bounds of a
MachineInstr operands list. The InstClass check is also cheaper.

This was introduced in SVN r373630.

Reviewers: tstellar

Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68690
llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp