From d59ae907eea28285ece6696d6f3271b4ca578c0d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 26 Jan 2012 02:32:04 +0000 Subject: Continue improving support for ConstantDataAggregate, and use the new methods recently added to (sometimes greatly!) simplify code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149024 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/SCCP.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lib/Transforms/Scalar/SCCP.cpp') diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index c4fc38ae08..1f8f452c36 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -408,15 +408,14 @@ private: return LV; // Common case, already in the map. if (Constant *C = dyn_cast(V)) { - if (isa(C)) - ; // Undef values remain undefined. - else if (ConstantStruct *CS = dyn_cast(C)) - LV.markConstant(CS->getOperand(i)); // Constants are constant. - else if (isa(C)) { - Type *FieldTy = cast(V->getType())->getElementType(i); - LV.markConstant(Constant::getNullValue(FieldTy)); - } else + Constant *Elt = C->getAggregateElement(i); + + if (Elt == 0) LV.markOverdefined(); // Unknown sort of constant. + else if (isa(Elt)) + ; // Undef values remain undefined. + else + LV.markConstant(Elt); // Constants are constant. } // All others are underdefined by default. -- cgit v1.2.3