[all-commits] [llvm/llvm-project] 3fc988: [indvars] Rotate zext though icmp to reduce loop v...

Philip Reames via All-commits all-commits at lists.llvm.org
Wed Nov 3 12:09:44 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3fc9882e880614093a36456fe83f9de023ac7851
      https://github.com/llvm/llvm-project/commit/3fc9882e880614093a36456fe83f9de023ac7851
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-11-03 (Wed, 03 Nov 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
    M llvm/test/Transforms/IndVarSimplify/finite-exit-comparisons.ll

  Log Message:
  -----------
  [indvars] Rotate zext though icmp to reduce loop varying computation

This change looks for cases where we can prove that an exit test of a loop can be performed in a narrower bitwidth, and that by doing so we can replace a loop-varying extend with a loop-invariant truncate.

The motivation here is that doing this unblocks the trip count analysis for narrow IVs involved in extended compare exit tests. It also has the nice side effect of simply making the code faster, even if we gain no other benefit from the improved analysis ability.

I've noted a few places this could be extended, but I think this stands reasonable on it's own as well.

Differential Revision: https://reviews.llvm.org/D112262




More information about the All-commits mailing list