@@ -3279,8 +3279,7 @@ static bool isRemovableWrite(CallBase &CB, Value *UsedV,
32793279
32803280static bool isAllocSiteRemovable (Instruction *AI,
32813281 SmallVectorImpl<WeakTrackingVH> &Users,
3282- const TargetLibraryInfo &TLI,
3283- bool KnowInit) {
3282+ const TargetLibraryInfo &TLI, bool KnowInit) {
32843283 SmallVector<Instruction*, 4 > Worklist;
32853284 const std::optional<StringRef> Family = getAllocationFamily (AI, &TLI);
32863285 Worklist.push_back (AI);
@@ -3349,12 +3348,14 @@ static bool isAllocSiteRemovable(Instruction *AI,
33493348 MemIntrinsic *MI = cast<MemIntrinsic>(II);
33503349 if (MI->isVolatile ())
33513350 return false ;
3352- // Note: this could also be ModRef, but we can still interpret that as just Mod in that case.
3353- ModRefInfo NewAccess = MI->getRawDest () == PI ? ModRefInfo::Mod : ModRefInfo::Ref;
3351+ // Note: this could also be ModRef, but we can still interpret that
3352+ // as just Mod in that case.
3353+ ModRefInfo NewAccess =
3354+ MI->getRawDest () == PI ? ModRefInfo::Mod : ModRefInfo::Ref;
33543355 if ((Access & ~NewAccess) != ModRefInfo::NoModRef)
33553356 return false ;
33563357 Access |= NewAccess;
3357- }
3358+ }
33583359 [[fallthrough]];
33593360 case Intrinsic::assume:
33603361 case Intrinsic::invariant_start:
@@ -3385,7 +3386,8 @@ static bool isAllocSiteRemovable(Instruction *AI,
33853386 continue ;
33863387 }
33873388
3388- if (!isRefSet (Access) && isRemovableWrite (*cast<CallBase>(I), PI, TLI)) {
3389+ if (!isRefSet (Access) &&
3390+ isRemovableWrite (*cast<CallBase>(I), PI, TLI)) {
33893391 Access |= ModRefInfo::Mod;
33903392 Users.emplace_back (I);
33913393 continue ;
@@ -3447,11 +3449,13 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) {
34473449 DIB.reset (new DIBuilder (*MI.getModule (), /* AllowUnresolved=*/ false ));
34483450 }
34493451
3450- // Determine what getInitialValueOfAllocation would return without actually allocating the result.
3452+ // Determine what getInitialValueOfAllocation would return without actually
3453+ // allocating the result.
34513454 bool KnowInitUndef = isa<AllocaInst>(MI);
34523455 bool KnowInitZero = false ;
34533456 if (!KnowInitUndef) {
3454- Constant *Init = getInitialValueOfAllocation (&MI, &TLI, Type::getInt8Ty (MI.getContext ()));
3457+ Constant *Init = getInitialValueOfAllocation (
3458+ &MI, &TLI, Type::getInt8Ty (MI.getContext ()));
34553459 if (Init) {
34563460 if (isa<UndefValue>(Init))
34573461 KnowInitUndef = true ;
@@ -3484,10 +3488,10 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) {
34843488 if (KnowInitZero && getUnderlyingObject (MTI->getRawDest ()) != &MI) {
34853489 IRBuilderBase::InsertPointGuard Guard (Builder);
34863490 Builder.SetInsertPoint (MTI);
3487- auto *M = Builder.CreateMemSet (MTI-> getRawDest (),
3488- ConstantInt::get ( Type::getInt8Ty (MI. getContext ()), 0 ),
3489- MTI-> getLength ( ),
3490- MTI->getDestAlign ());
3491+ auto *M = Builder.CreateMemSet (
3492+ MTI-> getRawDest ( ),
3493+ ConstantInt::get ( Type::getInt8Ty (MI. getContext ()), 0 ),
3494+ MTI-> getLength (), MTI->getDestAlign ());
34913495 M->copyMetadata (*MTI, LLVMContext::MD_DIAssignID);
34923496 }
34933497 }
@@ -3516,7 +3520,8 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) {
35163520 Constant *Replace;
35173521 if (isa<LoadInst>(I)) {
35183522 assert (KnowInitZero || KnowInitUndef);
3519- Replace = KnowInitUndef ? UndefValue::get (I->getType ()) : Constant::getNullValue (I->getType ());
3523+ Replace = KnowInitUndef ? UndefValue::get (I->getType ())
3524+ : Constant::getNullValue (I->getType ());
35203525 } else
35213526 Replace = PoisonValue::get (I->getType ());
35223527 replaceInstUsesWith (*I, Replace);
0 commit comments