[PATCH] D78145: [ValueLattice] Steal bits from Tag to track range extensions (NFC).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 12:58:27 PDT 2020


fhahn created this revision.
fhahn added reviewers: efriedma, davide, mssimpso.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78145

Files:
  llvm/include/llvm/Analysis/ValueLattice.h
  llvm/lib/Transforms/Scalar/SCCP.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78145.257457.patch
Type: text/x-patch
Size: 4118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200414/bb5f5e84/attachment.bin>


More information about the llvm-commits mailing list