@@ -3270,26 +3270,26 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) {
3270
3270
if (EnableHeapToStack)
3271
3271
getOrCreateAAFor<AAHeapToStack>(FPos);
3272
3272
3273
+ // Every function might be "must-progress".
3274
+ checkAndQueryIRAttr<Attribute::MustProgress, AAMustProgress>(FPos, FnAttrs);
3275
+
3276
+ // Every function might be "no-free".
3277
+ checkAndQueryIRAttr<Attribute::NoFree, AANoFree>(FPos, FnAttrs);
3278
+
3279
+ // Every function might be "will-return".
3280
+ checkAndQueryIRAttr<Attribute::WillReturn, AAWillReturn>(FPos, FnAttrs);
3281
+
3273
3282
// Everything that is visible from the outside (=function, argument, return
3274
3283
// positions), cannot be changed if the function is not IPO amendable. We can
3275
3284
// however analyse the code inside.
3276
3285
if (IsIPOAmendable) {
3277
3286
3278
- // Every function might be "will-return".
3279
- checkAndQueryIRAttr<Attribute::WillReturn, AAWillReturn>(FPos, FnAttrs);
3280
-
3281
- // Every function might be "must-progress".
3282
- checkAndQueryIRAttr<Attribute::MustProgress, AAMustProgress>(FPos, FnAttrs);
3283
-
3284
3287
// Every function can be nounwind.
3285
3288
checkAndQueryIRAttr<Attribute::NoUnwind, AANoUnwind>(FPos, FnAttrs);
3286
3289
3287
3290
// Every function might be marked "nosync"
3288
3291
checkAndQueryIRAttr<Attribute::NoSync, AANoSync>(FPos, FnAttrs);
3289
3292
3290
- // Every function might be "no-free".
3291
- checkAndQueryIRAttr<Attribute::NoFree, AANoFree>(FPos, FnAttrs);
3292
-
3293
3293
// Every function might be "no-return".
3294
3294
checkAndQueryIRAttr<Attribute::NoReturn, AANoReturn>(FPos, FnAttrs);
3295
3295
@@ -3348,55 +3348,61 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) {
3348
3348
getOrCreateAAFor<AANoFPClass>(RetPos);
3349
3349
}
3350
3350
}
3351
+ }
3351
3352
3352
- for (Argument &Arg : F.args ()) {
3353
- IRPosition ArgPos = IRPosition::argument (Arg);
3354
- auto ArgNo = Arg.getArgNo ();
3355
- AttributeSet ArgAttrs = Attrs.getParamAttrs (ArgNo);
3353
+ for (Argument &Arg : F.args ()) {
3354
+ IRPosition ArgPos = IRPosition::argument (Arg);
3355
+ auto ArgNo = Arg.getArgNo ();
3356
+ AttributeSet ArgAttrs = Attrs.getParamAttrs (ArgNo);
3356
3357
3357
- // Every argument might be simplified. We have to go through the
3358
- // Attributor interface though as outside AAs can register custom
3359
- // simplification callbacks.
3360
- bool UsedAssumedInformation = false ;
3361
- getAssumedSimplified (ArgPos, /* AA */ nullptr , UsedAssumedInformation,
3362
- AA::Intraprocedural);
3358
+ if (!IsIPOAmendable) {
3359
+ if (Arg.getType ()->isPointerTy ())
3360
+ // Every argument with pointer type might be marked nofree.
3361
+ checkAndQueryIRAttr<Attribute::NoFree, AANoFree>(ArgPos, ArgAttrs);
3362
+ continue ;
3363
+ }
3364
+
3365
+ // Every argument might be simplified. We have to go through the
3366
+ // Attributor interface though as outside AAs can register custom
3367
+ // simplification callbacks.
3368
+ bool UsedAssumedInformation = false ;
3369
+ getAssumedSimplified (ArgPos, /* AA */ nullptr , UsedAssumedInformation,
3370
+ AA::Intraprocedural);
3363
3371
3364
- // Every argument might be dead.
3365
- getOrCreateAAFor<AAIsDead>(ArgPos);
3372
+ // Every argument might be dead.
3373
+ getOrCreateAAFor<AAIsDead>(ArgPos);
3366
3374
3367
- // Every argument might be marked noundef.
3368
- checkAndQueryIRAttr<Attribute::NoUndef, AANoUndef>(ArgPos, ArgAttrs);
3375
+ // Every argument might be marked noundef.
3376
+ checkAndQueryIRAttr<Attribute::NoUndef, AANoUndef>(ArgPos, ArgAttrs);
3369
3377
3370
- if (Arg.getType ()->isPointerTy ()) {
3371
- // Every argument with pointer type might be marked nonnull.
3372
- checkAndQueryIRAttr<Attribute::NonNull, AANonNull>(ArgPos, ArgAttrs);
3378
+ if (Arg.getType ()->isPointerTy ()) {
3379
+ // Every argument with pointer type might be marked nonnull.
3380
+ checkAndQueryIRAttr<Attribute::NonNull, AANonNull>(ArgPos, ArgAttrs);
3373
3381
3374
- // Every argument with pointer type might be marked noalias.
3375
- checkAndQueryIRAttr<Attribute::NoAlias, AANoAlias>(ArgPos, ArgAttrs);
3382
+ // Every argument with pointer type might be marked noalias.
3383
+ checkAndQueryIRAttr<Attribute::NoAlias, AANoAlias>(ArgPos, ArgAttrs);
3376
3384
3377
- // Every argument with pointer type might be marked dereferenceable.
3378
- getOrCreateAAFor<AADereferenceable>(ArgPos);
3385
+ // Every argument with pointer type might be marked dereferenceable.
3386
+ getOrCreateAAFor<AADereferenceable>(ArgPos);
3379
3387
3380
- // Every argument with pointer type might be marked align.
3381
- getOrCreateAAFor<AAAlign>(ArgPos);
3388
+ // Every argument with pointer type might be marked align.
3389
+ getOrCreateAAFor<AAAlign>(ArgPos);
3382
3390
3383
- // Every argument with pointer type might be marked nocapture.
3384
- checkAndQueryIRAttr<Attribute::NoCapture, AANoCapture>(ArgPos,
3385
- ArgAttrs);
3391
+ // Every argument with pointer type might be marked nocapture.
3392
+ checkAndQueryIRAttr<Attribute::NoCapture, AANoCapture>(ArgPos, ArgAttrs);
3386
3393
3387
- // Every argument with pointer type might be marked
3388
- // "readnone/readonly/writeonly/..."
3389
- getOrCreateAAFor<AAMemoryBehavior>(ArgPos);
3394
+ // Every argument with pointer type might be marked
3395
+ // "readnone/readonly/writeonly/..."
3396
+ getOrCreateAAFor<AAMemoryBehavior>(ArgPos);
3390
3397
3391
- // Every argument with pointer type might be marked nofree.
3392
- checkAndQueryIRAttr<Attribute::NoFree, AANoFree>(ArgPos, ArgAttrs);
3398
+ // Every argument with pointer type might be marked nofree.
3399
+ checkAndQueryIRAttr<Attribute::NoFree, AANoFree>(ArgPos, ArgAttrs);
3393
3400
3394
- // Every argument with pointer type might be privatizable (or
3395
- // promotable)
3396
- getOrCreateAAFor<AAPrivatizablePtr>(ArgPos);
3397
- } else if (AttributeFuncs::isNoFPClassCompatibleType (Arg.getType ())) {
3398
- getOrCreateAAFor<AANoFPClass>(ArgPos);
3399
- }
3401
+ // Every argument with pointer type might be privatizable (or
3402
+ // promotable)
3403
+ getOrCreateAAFor<AAPrivatizablePtr>(ArgPos);
3404
+ } else if (AttributeFuncs::isNoFPClassCompatibleType (Arg.getType ())) {
3405
+ getOrCreateAAFor<AANoFPClass>(ArgPos);
3400
3406
}
3401
3407
}
3402
3408
0 commit comments