Author: kosarev Date: Fri Oct 13 10:34:18 2017 New Revision: 315715 URL: http://llvm.org/viewvc/llvm-project?rev=315715&view=rev Log: [CodeGen] emitOMPArraySectionBase() to generate TBAA info along with LValue base info
Differential Revision: https://reviews.llvm.org/D38795 Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=315715&r1=315714&r2=315715&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original) +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Oct 13 10:34:18 2017 @@ -3318,8 +3318,11 @@ LValue CodeGenFunction::EmitArraySubscri static Address emitOMPArraySectionBase(CodeGenFunction &CGF, const Expr *Base, LValueBaseInfo &BaseInfo, + TBAAAccessInfo &TBAAInfo, QualType BaseTy, QualType ElTy, bool IsLowerBound) { + TBAAInfo = CGF.CGM.getTBAAAccessInfo(ElTy); + LValue BaseLVal; if (auto *ASE = dyn_cast<OMPArraySectionExpr>(Base->IgnoreParenImpCasts())) { BaseLVal = CGF.EmitOMPArraySectionExpr(ASE, IsLowerBound); @@ -3449,13 +3452,14 @@ LValue CodeGenFunction::EmitOMPArraySect Address EltPtr = Address::invalid(); LValueBaseInfo BaseInfo; + TBAAAccessInfo TBAAInfo; if (auto *VLA = getContext().getAsVariableArrayType(ResultExprTy)) { // The base must be a pointer, which is not an aggregate. Emit // it. It needs to be emitted first in case it's what captures // the VLA bounds. Address Base = - emitOMPArraySectionBase(*this, E->getBase(), BaseInfo, BaseTy, - VLA->getElementType(), IsLowerBound); + emitOMPArraySectionBase(*this, E->getBase(), BaseInfo, TBAAInfo, + BaseTy, VLA->getElementType(), IsLowerBound); // The element count here is the total number of non-VLA elements. llvm::Value *NumElements = getVLASize(VLA).first; @@ -3491,16 +3495,17 @@ LValue CodeGenFunction::EmitOMPArraySect ResultExprTy, !getLangOpts().isSignedOverflowDefined(), /*SignedIndices=*/false, E->getExprLoc()); BaseInfo = ArrayLV.getBaseInfo(); + TBAAInfo = CGM.getTBAAAccessInfo(ResultExprTy); } else { Address Base = emitOMPArraySectionBase(*this, E->getBase(), BaseInfo, - BaseTy, ResultExprTy, IsLowerBound); + TBAAInfo, BaseTy, ResultExprTy, + IsLowerBound); EltPtr = emitArraySubscriptGEP(*this, Base, Idx, ResultExprTy, !getLangOpts().isSignedOverflowDefined(), /*SignedIndices=*/false, E->getExprLoc()); } - return MakeAddrLValue(EltPtr, ResultExprTy, BaseInfo, - CGM.getTBAAAccessInfo(ResultExprTy)); + return MakeAddrLValue(EltPtr, ResultExprTy, BaseInfo, TBAAInfo); } LValue CodeGenFunction:: _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits