diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -5426,8 +5426,8 @@ ErrorUnsupported(E, "builtin function"); - // Unknown builtin, for now just dump it out and return undef. - return GetUndefRValue(E->getType()); + // Unknown builtin, for now just dump it out and return poison. + return GetPoisonRValue(E->getType()); } static Value *EmitTargetArchBuiltinExpr(CodeGenFunction *CGF, diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -5520,7 +5520,7 @@ EnsureInsertPoint(); // Return a reasonable RValue. - return GetUndefRValue(RetTy); + return GetPoisonRValue(RetTy); } // If this is a musttail call, return immediately. We do not branch to the @@ -5538,7 +5538,7 @@ Builder.CreateRet(CI); Builder.ClearInsertionPoint(); EnsureInsertPoint(); - return GetUndefRValue(RetTy); + return GetPoisonRValue(RetTy); } // Perform the swifterror writeback. @@ -5595,7 +5595,7 @@ case ABIArgInfo::Ignore: // If we are ignoring an argument that had a result, make sure to // construct the appropriate return value for our caller. - return GetUndefRValue(RetTy); + return GetPoisonRValue(RetTy); case ABIArgInfo::Extend: case ABIArgInfo::Direct: { diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1169,7 +1169,7 @@ return Builder.CreateICmpNE(V, llvm::Constant::getNullValue(V->getType())); } -RValue CodeGenFunction::GetUndefRValue(QualType Ty) { +RValue CodeGenFunction::GetPoisonRValue(QualType Ty) { if (Ty->isVoidType()) return RValue::get(nullptr); @@ -1177,7 +1177,7 @@ case TEK_Complex: { llvm::Type *EltTy = ConvertType(Ty->castAs()->getElementType()); - llvm::Value *U = llvm::UndefValue::get(EltTy); + llvm::Value *U = llvm::PoisonValue::get(EltTy); return RValue::getComplex(std::make_pair(U, U)); } @@ -1190,7 +1190,7 @@ } case TEK_Scalar: - return RValue::get(llvm::UndefValue::get(ConvertType(Ty))); + return RValue::get(llvm::PoisonValue::get(ConvertType(Ty))); } llvm_unreachable("bad evaluation kind"); } @@ -1198,7 +1198,7 @@ RValue CodeGenFunction::EmitUnsupportedRValue(const Expr *E, const char *Name) { ErrorUnsupported(E, Name); - return GetUndefRValue(E->getType()); + return GetPoisonRValue(E->getType()); } LValue CodeGenFunction::EmitUnsupportedLValue(const Expr *E, @@ -1207,7 +1207,7 @@ llvm::Type *ElTy = ConvertType(E->getType()); llvm::Type *Ty = llvm::PointerType::getUnqual(ElTy); return MakeAddrLValue( - Address(llvm::UndefValue::get(Ty), ElTy, CharUnits::One()), E->getType()); + Address(llvm::PoisonValue::get(Ty), ElTy, CharUnits::One()), E->getType()); } bool CodeGenFunction::IsWrappedCXXThis(const Expr *Obj) { diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -419,7 +419,7 @@ CGF.ErrorUnsupported(E, "complex expression"); llvm::Type *EltTy = CGF.ConvertType(getComplexType(E->getType())->getElementType()); - llvm::Value *U = llvm::UndefValue::get(EltTy); + llvm::Value *U = llvm::PoisonValue::get(EltTy); return ComplexPairTy(U, U); } @@ -1274,7 +1274,7 @@ CGF.ErrorUnsupported(E, "complex va_arg expression"); llvm::Type *EltTy = CGF.ConvertType(E->getType()->castAs()->getElementType()); - llvm::Value *U = llvm::UndefValue::get(EltTy); + llvm::Value *U = llvm::PoisonValue::get(EltTy); return ComplexPairTy(U, U); } diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -1624,7 +1624,7 @@ CGF.ErrorUnsupported(E, "scalar expression"); if (E->getType()->isVoidType()) return nullptr; - return llvm::UndefValue::get(CGF.ConvertType(E->getType())); + return llvm::PoisonValue::get(CGF.ConvertType(E->getType())); } Value * @@ -4906,7 +4906,7 @@ // If EmitVAArg fails, emit an error. if (!ArgPtr.isValid()) { CGF.ErrorUnsupported(VE, "va_arg expression"); - return llvm::UndefValue::get(ArgTy); + return llvm::PoisonValue::get(ArgTy); } // FIXME Volatility. diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -3740,8 +3740,8 @@ /// Create a check that a scalar RValue is non-null. llvm::Value *EmitNonNullRValueCheck(RValue RV, QualType T); - /// GetUndefRValue - Get an appropriate 'undef' rvalue for the given type. - RValue GetUndefRValue(QualType Ty); + /// GetPoisonRValue - Get an appropriate 'poison' rvalue for the given type. + RValue GetPoisonRValue(QualType Ty); /// EmitUnsupportedRValue - Emit a dummy r-value using the type of E /// and issue an ErrorUnsupported style diagnostic (using the diff --git a/libcxxabi/test/test_demangle.pass.cpp b/libcxxabi/test/test_demangle.pass.cpp --- a/libcxxabi/test/test_demangle.pass.cpp +++ b/libcxxabi/test/test_demangle.pass.cpp @@ -3169,7 +3169,7 @@ {"_ZN5clang7CodeGen15CodeGenFunction9EmitCheckEPN4llvm5ValueEj", "clang::CodeGen::CodeGenFunction::EmitCheck(llvm::Value*, unsigned int)"}, {"_ZN5clang7CodeGen15CodeGenFunction9getTrapBBEv", "clang::CodeGen::CodeGenFunction::getTrapBB()"}, {"_ZN5clang7CodeGen15CodeGenFunction24EmitComplexPrePostIncDecEPKNS_13UnaryOperatorENS0_6LValueEbb", "clang::CodeGen::CodeGenFunction::EmitComplexPrePostIncDec(clang::UnaryOperator const*, clang::CodeGen::LValue, bool, bool)"}, - {"_ZN5clang7CodeGen15CodeGenFunction14GetUndefRValueENS_8QualTypeE", "clang::CodeGen::CodeGenFunction::GetUndefRValue(clang::QualType)"}, + {"_ZN5clang7CodeGen15CodeGenFunction14GetPoisonRValueENS_8QualTypeE", "clang::CodeGen::CodeGenFunction::GetPoisonRValue(clang::QualType)"}, {"_ZN5clang7CodeGen15CodeGenFunction21EmitUnsupportedRValueEPKNS_4ExprEPKc", "clang::CodeGen::CodeGenFunction::EmitUnsupportedRValue(clang::Expr const*, char const*)"}, {"_ZN5clang7CodeGen15CodeGenFunction21EmitUnsupportedLValueEPKNS_4ExprEPKc", "clang::CodeGen::CodeGenFunction::EmitUnsupportedLValue(clang::Expr const*, char const*)"}, {"_ZN5clang7CodeGen15CodeGenFunction17EmitCheckedLValueEPKNS_4ExprE", "clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*)"},