forked from OSchip/llvm-project
Fix use-of-uninitialized-value in rG75f50e15bf8f
Differential Revision: https://reviews.llvm.org/D71126
This commit is contained in:
parent
69d2567624
commit
345fcccb33
|
@ -519,6 +519,9 @@ void llvm::deleteConstant(Constant *C) {
|
|||
case Constant::UndefValueVal:
|
||||
delete static_cast<UndefValue *>(C);
|
||||
break;
|
||||
case Constant::PoisonValueVal:
|
||||
delete static_cast<PoisonValue *>(C);
|
||||
break;
|
||||
case Constant::ConstantExprVal:
|
||||
if (isa<UnaryConstantExpr>(C))
|
||||
delete static_cast<UnaryConstantExpr *>(C);
|
||||
|
@ -1722,7 +1725,12 @@ UndefValue *UndefValue::get(Type *Ty) {
|
|||
/// Remove the constant from the constant table.
|
||||
void UndefValue::destroyConstantImpl() {
|
||||
// Free the constant and any dangling references to it.
|
||||
getContext().pImpl->UVConstants.erase(getType());
|
||||
if (getValueID() == UndefValueVal) {
|
||||
getContext().pImpl->UVConstants.erase(getType());
|
||||
} else if (getValueID() == PoisonValueVal) {
|
||||
getContext().pImpl->PVConstants.erase(getType());
|
||||
}
|
||||
llvm_unreachable("Not a undef or a poison!");
|
||||
}
|
||||
|
||||
PoisonValue *PoisonValue::get(Type *Ty) {
|
||||
|
|
|
@ -97,6 +97,7 @@ LLVMContextImpl::~LLVMContextImpl() {
|
|||
CAZConstants.clear();
|
||||
CPNConstants.clear();
|
||||
UVConstants.clear();
|
||||
PVConstants.clear();
|
||||
IntConstants.clear();
|
||||
FPConstants.clear();
|
||||
CDSConstants.clear();
|
||||
|
|
|
@ -291,6 +291,7 @@ int FunctionComparator::cmpConstants(const Constant *L,
|
|||
|
||||
switch (L->getValueID()) {
|
||||
case Value::UndefValueVal:
|
||||
case Value::PoisonValueVal:
|
||||
case Value::ConstantTokenNoneVal:
|
||||
return TypesRes;
|
||||
case Value::ConstantIntVal: {
|
||||
|
|
Loading…
Reference in New Issue