[PATCH] D33543: Re-enable "[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start"

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 04:50:58 PDT 2017


mkazantsev created this revision.
Herald added subscribers: mzolotukhin, aemerson.

The patch https://reviews.llvm.org/rL303730 was reverted because test lsr-expand-quadratic.ll failed on many non-X86 configs with this patch.
The reason of this is that the patch makes a correctless fix that changes optimizer's behavior for this test. Now, following
the right execution path, LSR tries to make a transformation relying on IV Users analysis. This analysis is target-dependent
due to this code:

  // LSR is not APInt clean, do not touch integers bigger than 64-bits.
  // Also avoid creating IVs of non-native types. For example, we don't want a
  // 64-bit IV in 32-bit code just because the loop has one 64-bit cast.
  uint64_t Width = SE->getTypeSizeInBits(I->getType());
  if (Width > 64 || !DL.isLegalInteger(Width))
    return false;

To make a proper transformation in this test case, the type i32 needs to be legal for
the specified data layout. When the test runs on some non-X86 configuration
(e.g. pure ARM 64), opt gets confused by the specified target and does not use it,
rejecting the specified data layout as well. Instead, it uses some default layout that
does not treat i32 as a legal type (currently the layout that is used when it is not
specified does not have legal types at all). As result, the transformation we expect to
happen does not happen for this test.

This re-enabling patch does not have any source code changes compared to the
original patch https://reviews.llvm.org/rL303730. The only difference is that the failing test is moved to
X86 directory and now has requirement of running on x86 only to comply with
the specified target triple and data layout.


https://reviews.llvm.org/D33543

Files:
  include/llvm/Analysis/ScalarEvolution.h
  lib/Analysis/ScalarEvolution.cpp
  test/Analysis/IVUsers/quadradic-exit-value.ll
  test/Analysis/ScalarEvolution/different-loops-recs.ll
  test/Transforms/LoopStrengthReduce/X86/incorrect-offset-scaling.ll
  test/Transforms/LoopStrengthReduce/X86/lsr-expand-quadratic.ll
  test/Transforms/LoopStrengthReduce/lsr-expand-quadratic.ll
  test/Transforms/LoopStrengthReduce/post-inc-icmpzero.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33543.100223.patch
Type: text/x-patch
Size: 15425 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170525/2618096f/attachment.bin>


More information about the llvm-commits mailing list