[PATCH] D45191: [LoopReroll] Rewrite induction variable rewriting.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 2 16:33:06 PDT 2018


efriedma created this revision.
efriedma added reviewers: hfinkel, jmolloy.

This gets rid of a bunch of weird special cases; instead of trying to understand the structure of the induction variable, just use SCEV expansion for everything.  In addition to being simpler, this fixes a bug where we would use the wrong stride in certain edge cases; see the new test pointer_bitcast_baseinst.  (The bug might be a regression from https://reviews.llvm.org/D26529 ? Not sure.)

The one bit I'm not quite sure about is the trip count handling, specifically the FIXME about overflow.  In general, I think we need to widen the exit condition, but that's probably not profitable if the new type isn't legal, so we probably need a check somewhere.  That said, I don't think this patch makes the existing problem any worse.

As a followup to this, a bunch of other IV-related could be cleaned up and generalized, since the rewriting can handle more cases.


Repository:
  rL LLVM

https://reviews.llvm.org/D45191

Files:
  lib/Transforms/Scalar/LoopRerollPass.cpp
  test/Transforms/LoopReroll/basic.ll
  test/Transforms/LoopReroll/complex_reroll.ll
  test/Transforms/LoopReroll/indvar_with_ext.ll
  test/Transforms/LoopReroll/nonconst_lb.ll
  test/Transforms/LoopReroll/ptrindvar.ll
  test/Transforms/LoopReroll/reduction.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45191.140701.patch
Type: text/x-patch
Size: 32090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180402/b3c6eecf/attachment.bin>


More information about the llvm-commits mailing list