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 @@ -5663,8 +5663,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 @@ -5712,7 +5712,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 @@ -5730,7 +5730,7 @@ Builder.CreateRet(CI); Builder.ClearInsertionPoint(); EnsureInsertPoint(); - return GetUndefRValue(RetTy); + return GetPoisonRValue(RetTy); } // Perform the swifterror writeback. @@ -5785,7 +5785,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 @@ -1176,7 +1176,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); @@ -1184,7 +1184,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)); } @@ -1197,7 +1197,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"); } @@ -1205,7 +1205,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, @@ -1214,7 +1214,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 @@ -415,7 +415,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); } @@ -1275,7 +1275,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 @@ -1630,7 +1630,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 * @@ -4958,7 +4958,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 @@ -3774,8 +3774,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