@@ -2365,7 +2365,7 @@ struct AANonNullImpl : AANonNull {
2365
2365
2366
2366
// / See AbstractAttribute::initialize(...).
2367
2367
void initialize (Attributor &A) override {
2368
- Value &V = getAssociatedValue ();
2368
+ Value &V = * getAssociatedValue (). stripPointerCasts ();
2369
2369
if (!NullIsDefined &&
2370
2370
hasAttr ({Attribute::NonNull, Attribute::Dereferenceable},
2371
2371
/* IgnoreSubsumingPositions */ false , &A)) {
@@ -2389,7 +2389,7 @@ struct AANonNullImpl : AANonNull {
2389
2389
}
2390
2390
}
2391
2391
2392
- if (isa<GlobalValue>(& getAssociatedValue () )) {
2392
+ if (isa<GlobalValue>(V )) {
2393
2393
indicatePessimisticFixpoint ();
2394
2394
return ;
2395
2395
}
@@ -4217,6 +4217,7 @@ struct AADereferenceableImpl : AADereferenceable {
4217
4217
4218
4218
// / See AbstractAttribute::initialize(...).
4219
4219
void initialize (Attributor &A) override {
4220
+ Value &V = *getAssociatedValue ().stripPointerCasts ();
4220
4221
SmallVector<Attribute, 4 > Attrs;
4221
4222
getAttrs ({Attribute::Dereferenceable, Attribute::DereferenceableOrNull},
4222
4223
Attrs, /* IgnoreSubsumingPositions */ false , &A);
@@ -4227,9 +4228,8 @@ struct AADereferenceableImpl : AADereferenceable {
4227
4228
NonNullAA = &A.getAAFor <AANonNull>(*this , IRP, DepClassTy::NONE);
4228
4229
4229
4230
bool CanBeNull, CanBeFreed;
4230
- takeKnownDerefBytesMaximum (
4231
- IRP.getAssociatedValue ().getPointerDereferenceableBytes (
4232
- A.getDataLayout (), CanBeNull, CanBeFreed));
4231
+ takeKnownDerefBytesMaximum (V.getPointerDereferenceableBytes (
4232
+ A.getDataLayout (), CanBeNull, CanBeFreed));
4233
4233
4234
4234
bool IsFnInterface = IRP.isFnInterfaceKind ();
4235
4235
Function *FnScope = IRP.getAnchorScope ();
@@ -4520,7 +4520,7 @@ struct AAAlignImpl : AAAlign {
4520
4520
for (const Attribute &Attr : Attrs)
4521
4521
takeKnownMaximum (Attr.getValueAsInt ());
4522
4522
4523
- Value &V = getAssociatedValue ();
4523
+ Value &V = * getAssociatedValue (). stripPointerCasts ();
4524
4524
takeKnownMaximum (V.getPointerAlignment (A.getDataLayout ()).value ());
4525
4525
4526
4526
if (getIRPosition ().isFnInterfaceKind () &&
0 commit comments