@@ -1582,25 +1582,31 @@ static void printConstant(const Constant *COp, unsigned BitWidth,
15821582 bool IsFP = EltTy->isHalfTy () || EltTy->isFloatTy () || EltTy->isDoubleTy ();
15831583 unsigned EltBits = EltTy->getPrimitiveSizeInBits ();
15841584 unsigned E = std::min (BitWidth / EltBits, CDS->getNumElements ());
1585- assert ((BitWidth % EltBits) == 0 && " Element size mismatch" );
1586- for (unsigned I = 0 ; I != E; ++I) {
1587- if (I != 0 )
1588- CS << " ," ;
1589- if (IsInteger)
1590- printConstant (CDS->getElementAsAPInt (I), CS, PrintZero);
1591- else if (IsFP)
1592- printConstant (CDS->getElementAsAPFloat (I), CS, PrintZero);
1593- else
1594- CS << " ?" ;
1585+ if ((BitWidth % EltBits) == 0 ) {
1586+ for (unsigned I = 0 ; I != E; ++I) {
1587+ if (I != 0 )
1588+ CS << " ," ;
1589+ if (IsInteger)
1590+ printConstant (CDS->getElementAsAPInt (I), CS, PrintZero);
1591+ else if (IsFP)
1592+ printConstant (CDS->getElementAsAPFloat (I), CS, PrintZero);
1593+ else
1594+ CS << " ?" ;
1595+ }
1596+ } else {
1597+ CS << " ?" ;
15951598 }
15961599 } else if (auto *CV = dyn_cast<ConstantVector>(COp)) {
15971600 unsigned EltBits = CV->getType ()->getScalarSizeInBits ();
15981601 unsigned E = std::min (BitWidth / EltBits, CV->getNumOperands ());
1599- assert ((BitWidth % EltBits) == 0 && " Element size mismatch" );
1600- for (unsigned I = 0 ; I != E; ++I) {
1601- if (I != 0 )
1602- CS << " ," ;
1603- printConstant (CV->getOperand (I), EltBits, CS, PrintZero);
1602+ if ((BitWidth % EltBits) == 0 ) {
1603+ for (unsigned I = 0 ; I != E; ++I) {
1604+ if (I != 0 )
1605+ CS << " ," ;
1606+ printConstant (CV->getOperand (I), EltBits, CS, PrintZero);
1607+ }
1608+ } else {
1609+ CS << " ?" ;
16041610 }
16051611 } else {
16061612 CS << " ?" ;
0 commit comments