[PATCH] D89540: [SCEV] Index type usually is, but is not guaranteed to be, equal to the pointer bit width

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 03:52:30 PDT 2020


lebedev.ri created this revision.
lebedev.ri added reviewers: mkazantsev, efriedma.
lebedev.ri added a project: LLVM.
Herald added subscribers: arphaman, javed.absar, hiraditya.
lebedev.ri requested review of this revision.

As it is being noticed in D89456 <https://reviews.llvm.org/D89456>, and being pointed out
by @efriedma https://reviews.llvm.org/D89456#inline-831603
if we use narrower type to represent the ConstantRange of a pointer,
we will end up with a wrong result.

In datalayout, there's pointer bit width, and a index bit width.
Latter is, by default, equal to the pointer bit width, but it can be different.
And SCEV uses index bit width everywhere, where pointer bit width was obviously meant..


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89540

Files:
  llvm/lib/Analysis/LoopAccessAnalysis.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
  llvm/test/Analysis/ScalarEvolution/ptrtoint-constantexpr-loop.ll
  llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89540.298585.patch
Type: text/x-patch
Size: 33020 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201016/3b48c6a4/attachment.bin>


More information about the llvm-commits mailing list