diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 3faea48466ba9..0b57c3bc538c6 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -410,9 +410,9 @@ Value *Mapper::mapValue(const Value *V) { } else if ((Flags & RF_IgnoreMissingLocals) && isa(VAM)) { MappedArgs.push_back(VAM); } else { - // If we cannot map the value, set the argument as undef. + // If we cannot map the value, set the argument as poison. MappedArgs.push_back(ValueAsMetadata::get( - UndefValue::get(VAM->getValue()->getType()))); + PoisonValue::get(VAM->getValue()->getType()))); } } return MetadataAsValue::get(V->getContext(), diff --git a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp index d9e63565b809e..fb1b4edf25328 100644 --- a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp +++ b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp @@ -347,8 +347,8 @@ TEST(ValueMapperTest, mapValueLocalInArgList) { // such as "metadata i32 %x" don't currently successfully maintain that // property. To keep RemapInstruction from crashing we need a non-null // return here, but we also shouldn't reference the unmapped local. Use - // undef for uses in a DIArgList. - auto *N0 = UndefValue::get(Type::getInt8Ty(C)); + // poison for uses in a DIArgList. + auto *N0 = PoisonValue::get(Type::getInt8Ty(C)); auto *N0AM = ValueAsMetadata::get(N0); std::vector N0Elts; N0Elts.push_back(N0AM);