[all-commits] [llvm/llvm-project] 4a5ede: [SCEV] Use both known bits and sign bits when comp...

Philip Reames via All-commits all-commits at lists.llvm.org
Fri Feb 19 08:29:40 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4a5edea1930ddbcd3af46827f6cc976cc1b30e2a
      https://github.com/llvm/llvm-project/commit/4a5edea1930ddbcd3af46827f6cc976cc1b30e2a
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-02-19 (Fri, 19 Feb 2021)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/add-expr-pointer-operand-sorting.ll
    M llvm/test/Analysis/ScalarEvolution/ashr.ll
    M llvm/test/Analysis/ScalarEvolution/extract-highbits-sameconstmask.ll
    M llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll
    M llvm/test/Analysis/ScalarEvolution/max-be-count-not-constant.ll
    M llvm/test/Analysis/ScalarEvolution/ptrtoint-constantexpr-loop.ll
    M llvm/test/Analysis/ScalarEvolution/ptrtoint.ll
    M llvm/test/Analysis/ScalarEvolution/ranges.ll
    M llvm/test/Analysis/ScalarEvolution/sext-to-zext.ll
    M llvm/test/Analysis/StackSafetyAnalysis/local.ll
    M llvm/test/Analysis/StackSafetyAnalysis/memintrin.ll
    M llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll

  Log Message:
  -----------
  [SCEV] Use both known bits and sign bits when computing range of SCEV unknowns

When computing a range for a SCEVUnknown, today we use computeKnownBits for unsigned ranges, and computeNumSignBots for signed ranges. This means we miss opportunities to improve range results.

One common missed pattern is that we have a signed range of a value which CKB can determine is positive, but CNSB doesn't convey that information. The current range includes the negative part, and is thus double the size.

Per the removed comment, the original concern which delayed using both (after some code merging years back) was a compile time concern. CTMark results (provided by Nikita, thanks!) showed a geomean impact of about 0.1%. This doesn't seem large enough to avoid higher quality results.

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




More information about the All-commits mailing list