@@ -928,10 +928,9 @@ static bool canEmitInitWithFewStoresAfterBZero(llvm::Constant *Init,
928928
929929// / For inits that canEmitInitWithFewStoresAfterBZero returned true for, emit
930930// / the scalar stores that would be required.
931- static void emitStoresForInitAfterBZero (CodeGenModule &CGM,
932- llvm::Constant *Init, Address Loc,
933- bool isVolatile, CGBuilderTy &Builder,
934- bool IsAutoInit) {
931+ void CodeGenFunction::emitStoresForInitAfterBZero (llvm::Constant *Init,
932+ Address Loc, bool isVolatile,
933+ bool IsAutoInit) {
935934 assert (!Init->isNullValue () && !isa<llvm::UndefValue>(Init) &&
936935 " called emitStoresForInitAfterBZero for zero or undef value." );
937936
@@ -952,8 +951,8 @@ static void emitStoresForInitAfterBZero(CodeGenModule &CGM,
952951 // If necessary, get a pointer to the element and emit it.
953952 if (!Elt->isNullValue () && !isa<llvm::UndefValue>(Elt))
954953 emitStoresForInitAfterBZero (
955- CGM, Elt, Builder.CreateConstInBoundsGEP2_32 (Loc, 0 , i), isVolatile,
956- Builder, IsAutoInit);
954+ Elt, Builder.CreateConstInBoundsGEP2_32 (Loc, 0 , i), isVolatile,
955+ IsAutoInit);
957956 }
958957 return ;
959958 }
@@ -966,9 +965,9 @@ static void emitStoresForInitAfterBZero(CodeGenModule &CGM,
966965
967966 // If necessary, get a pointer to the element and emit it.
968967 if (!Elt->isNullValue () && !isa<llvm::UndefValue>(Elt))
969- emitStoresForInitAfterBZero (CGM, Elt,
968+ emitStoresForInitAfterBZero (Elt,
970969 Builder.CreateConstInBoundsGEP2_32 (Loc, 0 , i),
971- isVolatile, Builder, IsAutoInit);
970+ isVolatile, IsAutoInit);
972971 }
973972}
974973
@@ -1169,10 +1168,10 @@ static Address createUnnamedGlobalForMemcpyFrom(CodeGenModule &CGM,
11691168 return SrcPtr.withElementType (CGM.Int8Ty );
11701169}
11711170
1172- static void emitStoresForConstant (CodeGenModule &CGM, const VarDecl &D,
1173- Address Loc, bool isVolatile,
1174- CGBuilderTy &Builder ,
1175- llvm::Constant *constant, bool IsAutoInit) {
1171+ void CodeGenFunction:: emitStoresForConstant (const VarDecl &D, Address Loc ,
1172+ bool isVolatile,
1173+ llvm::Constant *constant ,
1174+ bool IsAutoInit) {
11761175 auto *Ty = constant->getType ();
11771176 uint64_t ConstantSize = CGM.getDataLayout ().getTypeAllocSize (Ty);
11781177 if (!ConstantSize)
@@ -1201,8 +1200,7 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
12011200 constant->isNullValue () || isa<llvm::UndefValue>(constant);
12021201 if (!valueAlreadyCorrect) {
12031202 Loc = Loc.withElementType (Ty);
1204- emitStoresForInitAfterBZero (CGM, constant, Loc, isVolatile, Builder,
1205- IsAutoInit);
1203+ emitStoresForInitAfterBZero (constant, Loc, isVolatile, IsAutoInit);
12061204 }
12071205 return ;
12081206 }
@@ -1240,7 +1238,7 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
12401238 CharUnits::fromQuantity (Layout->getElementOffset (i));
12411239 Address EltPtr = Builder.CreateConstInBoundsByteGEP (
12421240 Loc.withElementType (CGM.Int8Ty ), CurOff);
1243- emitStoresForConstant (CGM, D, EltPtr, isVolatile, Builder ,
1241+ emitStoresForConstant (D, EltPtr, isVolatile,
12441242 constant->getAggregateElement (i), IsAutoInit);
12451243 }
12461244 return ;
@@ -1251,7 +1249,7 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
12511249 for (unsigned i = 0 ; i != ATy->getNumElements (); i++) {
12521250 Address EltPtr = Builder.CreateConstGEP (
12531251 Loc.withElementType (ATy->getElementType ()), i);
1254- emitStoresForConstant (CGM, D, EltPtr, isVolatile, Builder ,
1252+ emitStoresForConstant (D, EltPtr, isVolatile,
12551253 constant->getAggregateElement (i), IsAutoInit);
12561254 }
12571255 return ;
@@ -1269,24 +1267,22 @@ static void emitStoresForConstant(CodeGenModule &CGM, const VarDecl &D,
12691267 I->addAnnotationMetadata (" auto-init" );
12701268}
12711269
1272- static void emitStoresForZeroInit (CodeGenModule &CGM, const VarDecl &D,
1273- Address Loc, bool isVolatile,
1274- CGBuilderTy &Builder) {
1270+ void CodeGenFunction::emitStoresForZeroInit (const VarDecl &D, Address Loc,
1271+ bool isVolatile) {
12751272 llvm::Type *ElTy = Loc.getElementType ();
12761273 llvm::Constant *constant =
12771274 constWithPadding (CGM, IsPattern::No, llvm::Constant::getNullValue (ElTy));
1278- emitStoresForConstant (CGM, D, Loc, isVolatile, Builder , constant,
1275+ emitStoresForConstant (D, Loc, isVolatile, constant,
12791276 /* IsAutoInit=*/ true );
12801277}
12811278
1282- static void emitStoresForPatternInit (CodeGenModule &CGM, const VarDecl &D,
1283- Address Loc, bool isVolatile,
1284- CGBuilderTy &Builder) {
1279+ void CodeGenFunction::emitStoresForPatternInit (const VarDecl &D, Address Loc,
1280+ bool isVolatile) {
12851281 llvm::Type *ElTy = Loc.getElementType ();
12861282 llvm::Constant *constant = constWithPadding (
12871283 CGM, IsPattern::Yes, initializationPatternFor (CGM, ElTy));
12881284 assert (!isa<llvm::UndefValue>(constant));
1289- emitStoresForConstant (CGM, D, Loc, isVolatile, Builder , constant,
1285+ emitStoresForConstant (D, Loc, isVolatile, constant,
12901286 /* IsAutoInit=*/ true );
12911287}
12921288
@@ -1829,15 +1825,15 @@ void CodeGenFunction::emitZeroOrPatternForAutoVarInit(QualType type,
18291825 if (trivialAutoVarInitMaxSize > 0 &&
18301826 allocSize > trivialAutoVarInitMaxSize)
18311827 return ;
1832- emitStoresForZeroInit (CGM, D, Loc, isVolatile, Builder );
1828+ emitStoresForZeroInit (D, Loc, isVolatile);
18331829 break ;
18341830 case LangOptions::TrivialAutoVarInitKind::Pattern:
18351831 if (CGM.stopAutoInit ())
18361832 return ;
18371833 if (trivialAutoVarInitMaxSize > 0 &&
18381834 allocSize > trivialAutoVarInitMaxSize)
18391835 return ;
1840- emitStoresForPatternInit (CGM, D, Loc, isVolatile, Builder );
1836+ emitStoresForPatternInit (D, Loc, isVolatile);
18411837 break ;
18421838 }
18431839 return ;
@@ -2052,8 +2048,8 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
20522048 return EmitStoreThroughLValue (RValue::get (constant), lv, true );
20532049 }
20542050
2055- emitStoresForConstant (CGM, D, Loc.withElementType (CGM.Int8Ty ),
2056- type.isVolatileQualified (), Builder, constant,
2051+ emitStoresForConstant (D, Loc.withElementType (CGM.Int8Ty ),
2052+ type.isVolatileQualified (), constant,
20572053 /* IsAutoInit=*/ false );
20582054}
20592055
0 commit comments