[PATCH] D37419: Teach scalar evolution to handle inttoptr/ptrtoint

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 2 21:06:52 PDT 2017


davidxl created this revision.
Herald added subscribers: javed.absar, nemanjai.

This enhancement will enable loop vectorizations that are currently blocked due to noop inttoptr/ptrtoint operations.

The change itself is straightforward, but it exposes a few bugs in existing code. For instance, const_expr created by the expander  can grow exponentially  so some size  limit needs to be applied. The expander also invalidates some of the SCEVs for some of the values (when noop cast is inserted) which can leads to inconsistent SCEVs with other cached values when recomputed (e.g, when scalar loop's header phi's init value is replaced by loop vectorizer).  This patch also fixes those problems.


https://reviews.llvm.org/D37419

Files:
  lib/Analysis/ScalarEvolution.cpp
  lib/Analysis/ScalarEvolutionExpander.cpp
  lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Analysis/ScalarEvolution/timeout_constexpr.ll
  test/CodeGen/AArch64/arm64-2011-10-18-LdStOptBug.ll
  test/CodeGen/PowerPC/unal-altivec.ll
  test/Other/constant-fold-gep.ll
  test/Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll
  test/Transforms/LoopStrengthReduce/post-inc-icmpzero.ll
  test/Transforms/LoopVectorize/header_phi1.ll
  test/Transforms/LoopVectorize/header_phi2.ll
  test/Transforms/LoopVectorize/header_phi3.ll
  test/Transforms/LoopVectorize/intptr1.ll
  test/Transforms/LoopVectorize/intptr2.ll
  test/Transforms/LoopVectorize/intptr3.ll
  test/Transforms/LoopVectorize/intptr4.ll
  test/Transforms/LoopVectorize/intptr5.ll
  unittests/Analysis/ScalarEvolutionTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37419.113674.patch
Type: text/x-patch
Size: 31862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170903/5643ecc9/attachment.bin>


More information about the llvm-commits mailing list