[PATCH] D149483: [SCEV] Use object size for globals to sharpen ranges.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 13:56:09 PDT 2023


fhahn created this revision.
fhahn added reviewers: reames, nikic, nlopes, mkazantsev.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a project: LLVM.

The highest address the object can start is ObjSize bytes before the
end (unsigned max value). If this value is not a multiple of the
alignment, the last possible start value is the next lowest multiple
of the alignment. Note: The computations cannot overflow,
because if they would there's no possible start address for the
object.

At the moment, this is limited to GlobalVariables, because I could not
find a API similar to getObjectSize to also get the alignment of the
object. With such an API, this can be generalized to general addresses.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149483

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Analysis/ScalarEvolution/incorrect-exit-count.ll
  llvm/test/Analysis/ScalarEvolution/load.ll
  llvm/test/Analysis/ScalarEvolution/ptrtoint-global.ll
  llvm/test/Analysis/ScalarEvolution/scev-expander-reuse-gep.ll
  llvm/test/Transforms/IndVarSimplify/ptrtoint-global-cmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149483.518046.patch
Type: text/x-patch
Size: 14758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230428/fd25c253/attachment.bin>


More information about the llvm-commits mailing list