AMDGPU: Fix asan errors when folding operands

This was failing when trying to fold immediates into operand 1 of a
phi, which only has one statically known operand.

llvm-svn: 289337
This commit is contained in:
Matt Arsenault 2016-12-10 19:58:00 +00:00
parent fb58550d73
commit fbc728853f
1 changed files with 2 additions and 2 deletions

View File

@ -500,7 +500,7 @@ public:
const MachineOperand &DefMO) const { const MachineOperand &DefMO) const {
assert(UseMO.getParent() == &MI); assert(UseMO.getParent() == &MI);
int OpIdx = MI.getOperandNo(&UseMO); int OpIdx = MI.getOperandNo(&UseMO);
if (!MI.getDesc().OpInfo || OpIdx > MI.getDesc().NumOperands) { if (!MI.getDesc().OpInfo || OpIdx >= MI.getDesc().NumOperands) {
return false; return false;
} }
@ -516,7 +516,7 @@ public:
bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx, bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx,
const MachineOperand &MO) const { const MachineOperand &MO) const {
if (!MI.getDesc().OpInfo || OpIdx > MI.getDesc().NumOperands) if (!MI.getDesc().OpInfo || OpIdx >= MI.getDesc().NumOperands)
return false; return false;
if (MI.isCopy()) { if (MI.isCopy()) {