[all-commits] [llvm/llvm-project] f9d8e3: [SCCP] Turn sext into zext for non-negative ranges.

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri Jun 19 02:19:24 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f9d8e33c324de95f868dbe50d0e1e475ef2d3beb
      https://github.com/llvm/llvm-project/commit/f9d8e33c324de95f868dbe50d0e1e475ef2d3beb
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2020-06-19 (Fri, 19 Jun 2020)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SCCP.cpp
    M llvm/test/Transforms/SCCP/ip-ranges-casts.ll
    M llvm/test/Transforms/SCCP/ip-ranges-sext.ll
    M llvm/test/Transforms/SCCP/ranges-sext.ll
    M llvm/test/Transforms/SCCP/widening.ll

  Log Message:
  -----------
  [SCCP] Turn sext into zext for non-negative ranges.

This patch updates SCCP/IPSCCP to use the computed range info to turn
sexts into zexts, if the value is known to be non-negative. We already
to a similar transform in CorrelatedValuePropagation, but it seems like
we can catch a lot of additional cases by doing it in SCCP/IPSCCP as
well.

The transform is limited to ranges that are known to not include undef.

Currently constant ranges from conditions are treated as potentially
containing undef, due to PR46144. Once we flip this, the transform will
be more effective in practice.

Reviewers: efriedma, davide

Reviewed By: efriedma

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




More information about the All-commits mailing list