mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-24 12:50:42 +00:00
Use foreach loops for StructType::elements(). NFC.
We had a few places where we did for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { but those could instead do for (auto *EltTy : STy->elements()) { git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243136 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c653b44276
commit
2914cbf164
@ -940,9 +940,9 @@ static void getMaxByValAlign(Type *Ty, unsigned &MaxAlign,
|
||||
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)
|
||||
|
@ -1818,9 +1818,9 @@ static void getMaxByValAlign(Type *Ty, unsigned &MaxAlign) {
|
||||
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)
|
||||
|
@ -281,8 +281,8 @@ CallGraphNode *ArgPromotion::PromoteArguments(CallGraphNode *CGN) {
|
||||
|
||||
// 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;
|
||||
}
|
||||
@ -303,8 +303,8 @@ CallGraphNode *ArgPromotion::PromoteArguments(CallGraphNode *CGN) {
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user