[llvm] [Analysis] Teach ScalarEvolution::getRangeRef about more dereferenceable objects (PR #104778)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 06:57:47 PDT 2024
================
@@ -6858,10 +6858,9 @@ const ConstantRange &ScalarEvolution::getRangeRef(
ObjectSizeOpts Opts;
Opts.RoundToAlign = false;
Opts.NullIsUnknownSize = true;
- uint64_t ObjSize;
- if ((isa<GlobalVariable>(V) || isa<AllocaInst>(V) ||
- isAllocationFn(V, &TLI)) &&
- getObjectSize(V, ObjSize, DL, &TLI, Opts) && ObjSize > 1) {
+ bool CanBeNull, CanBeFreed;
+ uint64_t ObjSize = V->getPointerDereferenceableBytes(DL, CanBeNull, CanBeFreed);
----------------
nikic wrote:
ObjSize -> DerefBytes or something. It may not be the full object size.
https://github.com/llvm/llvm-project/pull/104778
More information about the llvm-commits
mailing list