[all-commits] [llvm/llvm-project] c245d3: [ValueLattice] Steal bits from Tag to track range ...

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri Apr 17 07:38:50 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c245d3e033a58582475c3d749085f47a9ab0dda1
      https://github.com/llvm/llvm-project/commit/c245d3e033a58582475c3d749085f47a9ab0dda1
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2020-04-17 (Fri, 17 Apr 2020)

  Changed paths:
    M llvm/include/llvm/Analysis/ValueLattice.h
    M llvm/lib/Transforms/Scalar/SCCP.cpp

  Log Message:
  -----------
  [ValueLattice] Steal bits from Tag to track range extensions (NFC).

Users of ValueLatticeElement currently have to ensure constant ranges
are not extended indefinitely. For example, in SCCP, mergeIn goes to
overdefined if a constantrange value is repeatedly merged with larger
constantranges. This is a simple form of widening.

In some cases, this leads to an unnecessary loss of information and
things can be improved by allowing a small number of extensions in the
hope that a fixed point is reached after a small number of steps.

To make better decisions about widening, it is helpful to keep track of
the number of range extensions. That state is tied directly to a
concrete ValueLatticeElement and some unused bits in the class can be
used. The current patch preserves the existing behavior by default:
CheckWiden defaults to false and if CheckWiden is true, a single change
to the range is allowed.

Follow-up patches will slightly increase the threshold for widening.

Reviewers: efriedma, davide, mssimpso

Reviewed By: efriedma

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




More information about the All-commits mailing list