if (EltAlign > MaxAlign)
MaxAlign = EltAlign;
} else if (StructType *STy = dyn_cast<StructType>(Ty)) {
- for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
+ for (auto *EltTy : STy->elements()) {
unsigned EltAlign = 0;
- getMaxByValAlign(STy->getElementType(i), EltAlign, MaxMaxAlign);
+ getMaxByValAlign(EltTy, EltAlign, MaxMaxAlign);
if (EltAlign > MaxAlign)
MaxAlign = EltAlign;
if (MaxAlign == MaxMaxAlign)
if (EltAlign > MaxAlign)
MaxAlign = EltAlign;
} else if (StructType *STy = dyn_cast<StructType>(Ty)) {
- for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
+ for (auto *EltTy : STy->elements()) {
unsigned EltAlign = 0;
- getMaxByValAlign(STy->getElementType(i), EltAlign);
+ getMaxByValAlign(EltTy, EltAlign);
if (EltAlign > MaxAlign)
MaxAlign = EltAlign;
if (MaxAlign == 16)
// If all the elements are single-value types, we can promote it.
bool AllSimple = true;
- for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
- if (!STy->getElementType(i)->isSingleValueType()) {
+ for (const auto *EltTy : STy->elements()) {
+ if (!EltTy->isSingleValueType()) {
AllSimple = false;
break;
}
if (isSelfRecursive) {
if (StructType *STy = dyn_cast<StructType>(AgTy)) {
bool RecursiveType = false;
- for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
- if (STy->getElementType(i) == PtrArg->getType()) {
+ for (const auto *EltTy : STy->elements()) {
+ if (EltTy == PtrArg->getType()) {
RecursiveType = true;
break;
}