[PATCH] D75055: [ValueLattice] Merging a constant range with undefined is overdefined.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 08:21:56 PST 2020


fhahn created this revision.
fhahn added reviewers: nikic, reames, efriedma, lebedev.ri.
Herald added a subscriber: dexonsmith.
Herald added a project: LLVM.

When merging a non-singleton constant range with undefined, we have to
go to overdefined. For constant ranges, we cannot guarantee that we will
be able to replace all uses of the underlying value which could lead to
contradictions with other transforms/analysis.

Note that we still cannot go to overdefined when merging undefined and a
constant range, because we initially create all elements as undefined.
But that should be fine, because that should only happen when setting
the initial concrete value.

Fixes PR44949.

Even though this might slightly pessimizes the analysis, if the
undefined value is truly not reachable, but the impact in practice seems
relatively low. I've built MultiSource, SPEC2000, SPEC2006 with -O3 +
LTO and collected the number of times CVP fired using

  cat result.json | grep correlated | cut -d" " -f 10 | cut -d',' -f 1 | awk '{s+=$1} END {print s}'

Without this patch: 158985
With this patch:    158957

Alternatively we could force undef constants to overdefined (as
suggested by @efriedma in D61314 <https://reviews.llvm.org/D61314>) or replace the undefs in the IR with
other constants.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75055

Files:
  llvm/include/llvm/Analysis/ValueLattice.h
  llvm/test/Transforms/CorrelatedValuePropagation/merge-range-and-undef.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75055.246220.patch
Type: text/x-patch
Size: 5307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200224/77a2149b/attachment.bin>


More information about the llvm-commits mailing list