Fix MachineInstr::findRegisterUseOperandIdx subreg checks
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Mon, 12 Nov 2018 18:12:28 +0000 (18:12 +0000)
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Mon, 12 Nov 2018 18:12:28 +0000 (18:12 +0000)
commit5f9513147a4f0005a6a1bfa2da9081455ef906b4
tree1dd80ef3167d6307327694cbfb23a61616fabe16
parentdbf552c40f3916d1ec0deca11bc432b91b8ea17a
Fix MachineInstr::findRegisterUseOperandIdx subreg checks

The function only checks that instruction reads a super-register
containing requested physical register. In case if a sub-register
if being read that is also a use of a super-reg, so added the check.
In particular MI->readsRegister() is broken because of the missing
check. The resulting check is essentially regsOverlap().

Differential Revision: https://reviews.llvm.org/D54128

llvm-svn: 346686
llvm/lib/CodeGen/MachineInstr.cpp
llvm/test/CodeGen/AMDGPU/optimize-if-exec-masking.mir