diff --git a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp index 77350dbb6167cb..c80d60c3a52112 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp @@ -329,8 +329,8 @@ bool LiveRegOptimizer::optimizeLiveType( Type *NewType = calculateConvertType(Phi->getType()); NewPhi->addIncoming(ConstantInt::get(NewType, 0, false), Phi->getIncomingBlock(I)); - } else if (ValMap.contains(IncVal) && ValMap[IncVal]) - NewPhi->addIncoming(ValMap[IncVal], Phi->getIncomingBlock(I)); + } else if (Value *Val = ValMap.lookup(IncVal)) + NewPhi->addIncoming(Val, Phi->getIncomingBlock(I)); else MissingIncVal = true; }