[llvm] c14213e - [Attributor][NFC] Move some trivial checks up
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 3 22:36:27 PST 2021
Author: Johannes Doerfert
Date: 2021-03-04T00:35:52-06:00
New Revision: c14213e030a98f4e1424358ecf69963f531a4949
URL: https://github.com/llvm/llvm-project/commit/c14213e030a98f4e1424358ecf69963f531a4949
DIFF: https://github.com/llvm/llvm-project/commit/c14213e030a98f4e1424358ecf69963f531a4949.diff
LOG: [Attributor][NFC] Move some trivial checks up
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 77c34a108671..4018cf13fc85 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -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);
More information about the llvm-commits
mailing list