[PATCH] D103656: [ScalarEvolution] Ensure backedge-taken counts are not pointers.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 3 16:09:24 PDT 2021


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

A backedge-taken count doesn't refer to memory; returning a pointer type is nonsense. So convert the operands of the relevant icmps to integer types.

The test changes are mostly innocuous. The most interesting changes are more complex SCEV expressions of the form "(-1 * (ptrtoint i8* %ptr to i64)) + %ptr)". This is expected: we can't fold this to zero because we need to preserve the pointer base.

See https://bugs.llvm.org/show_bug.cgi?id=46786 for context.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103656

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
  llvm/test/Analysis/ScalarEvolution/nsw.ll
  llvm/test/Analysis/ScalarEvolution/ptrtoint.ll
  llvm/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll
  llvm/test/Transforms/IndVarSimplify/eliminate-exit-no-dl.ll
  llvm/test/Transforms/IndVarSimplify/lftr-address-space-pointers.ll
  llvm/test/Transforms/IndVarSimplify/lftr-reuse.ll
  llvm/test/Transforms/LoopIdiom/memset-debugify-remarks.ll
  llvm/test/Transforms/LoopReroll/ptrindvar.ll
  llvm/test/Transforms/LoopVectorize/X86/cost-model-assert.ll
  llvm/test/Transforms/LoopVectorize/pointer-induction.ll
  llvm/test/Transforms/LoopVectorize/pr45259.ll
  llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103656.349718.patch
Type: text/x-patch
Size: 63329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210603/de4a56d9/attachment-0001.bin>


More information about the llvm-commits mailing list