[Attributor][NFC] Move some trivial checks up

This commit is contained in:
Johannes Doerfert 2021-03-01 17:15:26 -06:00
parent 09c3eebf5f
commit c14213e030

View File

@ -1600,6 +1600,19 @@ static int64_t getKnownNonNullAndDerefBytesForUse(
if (!UseV->getType()->isPointerTy())
return 0;
// We need to follow common pointer manipulation uses to the accesses they
// feed into. We can try to be smart to avoid looking through things we do not
// like for now, e.g., non-inbounds GEPs.
if (isa<CastInst>(I)) {
TrackUse = true;
return 0;
}
if (isa<GetElementPtrInst>(I)) {
TrackUse = true;
return 0;
}
Type *PtrTy = UseV->getType();
const Function *F = I->getFunction();
bool NullPointerIsDefined =
@ -1631,19 +1644,6 @@ static int64_t getKnownNonNullAndDerefBytesForUse(
return DerefAA.getKnownDereferenceableBytes();
}
// We need to follow common pointer manipulation uses to the accesses they
// feed into. We can try to be smart to avoid looking through things we do not
// like for now, e.g., non-inbounds GEPs.
if (isa<CastInst>(I)) {
TrackUse = true;
return 0;
}
if (isa<GetElementPtrInst>(I)) {
TrackUse = true;
return 0;
}
int64_t Offset;
const Value *Base =
getMinimalBaseOfAccsesPointerOperand(A, QueryingAA, I, Offset, DL);