Skip to content

Commit 0258b0d

Browse files
committed
CGExpr: tweak generation of EltTBAAInfo
1 parent bba5ee5 commit 0258b0d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4510,17 +4510,14 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
45104510
} else if (ArrayLV.getTBAAInfo().isMayAlias()) {
45114511
EltTBAAInfo = TBAAAccessInfo::getMayAliasInfo();
45124512
} else if (ArrayLV.getTBAAInfo().isIncomplete()) {
4513+
// The array element is complete, even if the array is not.
45134514
EltTBAAInfo = CGM.getTBAAAccessInfo(E->getType());
45144515
} else {
45154516
// Extend struct path from base lvalue, similar to EmitLValueForField.
4516-
// If no base type has been assigned for the array access, then try to
4517-
// generate one.
45184517
EltTBAAInfo = ArrayLV.getTBAAInfo();
4519-
if (!EltTBAAInfo.BaseType) {
4520-
EltTBAAInfo.BaseType = CGM.getTBAABaseTypeInfo(ArrayLV.getType());
4521-
assert(!EltTBAAInfo.Offset &&
4522-
"Nonzero offset for an access with no base type!");
4523-
}
4518+
// If no base type has been assigned for the array access, there is no
4519+
// point trying to generate one, since an array is not a valid base type.
4520+
//
45244521
// The index into the array is a runtime value. We use the same struct
45254522
// path for all array elements (that of the element at index 0). So we
45264523
// set the access type and size, but do not have to adjust

0 commit comments

Comments
 (0)