[PATCH] D48229: [NFC][SCEV] Add tests related to bit masking (PR37793)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 15 11:06:40 PDT 2018


lebedev.ri created this revision.
lebedev.ri added reviewers: mkazantsev, spatel, efriedma.
Herald added subscribers: javed.absar, sanjoy.

Related to https://bugs.llvm.org/show_bug.cgi?id=37793, https://reviews.llvm.org/D46760#1127287

We'd like to do this canonicalization https://rise4fun.com/Alive/Gmc
But it is currently restricted by https://reviews.llvm.org/rL155136 / https://reviews.llvm.org/rL155362, which says:

  // This is a constant shift of a constant shift. Be careful about hiding
  // shl instructions behind bit masks. They are used to represent multiplies
  // by a constant, and it is important that simple arithmetic expressions
  // are still recognizable by scalar evolution.
  //
  // The transforms applied to shl are very similar to the transforms applied
  // to mul by constant. We can be more aggressive about optimizing right
  // shifts.
  //
  // Combinations of right and left shifts will still be optimized in
  // DAGCombine where scalar evolution no longer applies.

I think these tests show that for *constants*, SCEV has no issues with that canonicalization.


Repository:
  rL LLVM

https://reviews.llvm.org/D48229

Files:
  test/Analysis/ScalarEvolution/extract-highbits-sameconstmask.ll
  test/Analysis/ScalarEvolution/extract-highbits-variablemask.ll
  test/Analysis/ScalarEvolution/extract-lowbits-sameconstmask.ll
  test/Analysis/ScalarEvolution/extract-lowbits-variablemask.ll
  test/Analysis/ScalarEvolution/lshr-shl-differentconstmask.ll
  test/Analysis/ScalarEvolution/shl-lshr-differentconstmask.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48229.151535.patch
Type: text/x-patch
Size: 22502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180615/c2425068/attachment.bin>


More information about the llvm-commits mailing list