From 93604b6de20f6a2ce160bfa65ef5d99cc8e577f3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 17 Jul 2010 06:13:52 +0000 Subject: Fix PR7658, a problem where type refinement can trigger constant replacement which was botching its handling of types. Use of getType() instead of getRawType() was causing the type map in constant folding to be updated wrong. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108610 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/ConstantsContext.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/VMCore/ConstantsContext.h') diff --git a/lib/VMCore/ConstantsContext.h b/lib/VMCore/ConstantsContext.h index 2f2fac53f0..b86ea60ede 100644 --- a/lib/VMCore/ConstantsContext.h +++ b/lib/VMCore/ConstantsContext.h @@ -757,9 +757,13 @@ public: // If this constant is the representative element for its abstract type, // update the AbstractTypeMap so that the representative element is I. - if (C->getType()->isAbstract()) { + // + // This must use getRawType() because if the type is under refinement, we + // will get the refineAbstractType callback below, and we don't want to + // kick union find in on the constant. + if (C->getRawType()->isAbstract()) { typename AbstractTypeMapTy::iterator ATI = - AbstractTypeMap.find(C->getType()); + AbstractTypeMap.find(cast(C->getRawType())); assert(ATI != AbstractTypeMap.end() && "Abstract type not in AbstractTypeMap?"); if (ATI->second == OldI) -- cgit v1.2.3