diff options
-rw-r--r-- | lib/VMCore/Constants.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 76904ad3f9..8fa5342ff3 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -668,10 +668,12 @@ void ConstantPointerNull::refineAbstractType(const DerivedType *OldTy, Value::refineAbstractType(OldTy, NewTy); // Make everyone now use a constant of the new type... - replaceAllUsesWith(ConstantPointerNull::get(cast<PointerType>(NewTy))); - - // This constant is now dead, destroy it. - destroyConstant(); + if (NewTy != OldTy) { + replaceAllUsesWith(ConstantPointerNull::get(cast<PointerType>(NewTy))); + + // This constant is now dead, destroy it. + destroyConstant(); + } } |