From fbc728853fce754143e5b8f5426c1f6c43b1377a Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sat, 10 Dec 2016 19:58:00 +0000 Subject: [PATCH] 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 --- llvm/lib/Target/AMDGPU/SIInstrInfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.h b/llvm/lib/Target/AMDGPU/SIInstrInfo.h index 81d0ef4..e68f6f9 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.h +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.h @@ -500,7 +500,7 @@ public: const MachineOperand &DefMO) const { assert(UseMO.getParent() == &MI); int OpIdx = MI.getOperandNo(&UseMO); - if (!MI.getDesc().OpInfo || OpIdx > MI.getDesc().NumOperands) { + if (!MI.getDesc().OpInfo || OpIdx >= MI.getDesc().NumOperands) { return false; } @@ -516,7 +516,7 @@ public: bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx, const MachineOperand &MO) const { - if (!MI.getDesc().OpInfo || OpIdx > MI.getDesc().NumOperands) + if (!MI.getDesc().OpInfo || OpIdx >= MI.getDesc().NumOperands) return false; if (MI.isCopy()) { -- 2.7.4