[all-commits] [llvm/llvm-project] 73818f: [NFC][ScalarEvolution] Add tests with ptrtoint in ...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Mon Oct 12 13:04:02 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 73818f450e3a90fc89eca143ee30777ed7e660e9
      https://github.com/llvm/llvm-project/commit/73818f450e3a90fc89eca143ee30777ed7e660e9
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-10-12 (Mon, 12 Oct 2020)

  Changed paths:
    A llvm/test/Analysis/ScalarEvolution/ptrtoint-constantexpr-loop.ll

  Log Message:
  -----------
  [NFC][ScalarEvolution] Add tests with ptrtoint in constant context in loop

Reduced from the https://reviews.llvm.org/D88806#2325340


  Commit: 1fb610429308a7c29c5065f5cc35dcc3fd69c8b1
      https://github.com/llvm/llvm-project/commit/1fb610429308a7c29c5065f5cc35dcc3fd69c8b1
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-10-12 (Mon, 12 Oct 2020)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
    M llvm/test/Analysis/ScalarEvolution/add-expr-pointer-operand-sorting.ll
    M llvm/test/Analysis/ScalarEvolution/no-wrap-add-exprs.ll
    M llvm/test/Analysis/ScalarEvolution/ptrtoint-constantexpr-loop.ll
    M llvm/test/Analysis/ScalarEvolution/ptrtoint.ll
    M llvm/test/CodeGen/ARM/lsr-undef-in-binop.ll
    M llvm/test/CodeGen/X86/ragreedy-hoist-spill.ll
    M llvm/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll
    M polly/test/Isl/CodeGen/scev_looking_through_bitcasts.ll

  Log Message:
  -----------
  Reland "[SCEV] Model ptrtoint(SCEVUnknown) cast not as unknown, but as zext/trunc/self of SCEVUnknown"

This relands commit 1c021c64caef83cccb719c9bf0a2554faa6563af which was
reverted in commit 17cec6a11a12f815052d56a17ef738cf246a2d9a because
an assertion was being triggered, since `BuildConstantFromSCEV()`
wasn't updated to handle the case where the constant we want to truncate
is actually a pointer. I was unsuccessful in coming up with a test case
where we'd end there with constant zext/sext of a pointer,
so i didn't handle those cases there until there is a test case.

Original commit message:

While we indeed can't treat them as no-ops, i believe we can/should
do better than just modelling them as `unknown`. `inttoptr` story
is complicated, but for `ptrtoint`, it seems straight-forward
to model it just as a zext-or-trunc of unknown.

This may be important now that we track towards
making inttoptr/ptrtoint casts not no-op,
and towards preventing folding them into loads/etc
(see D88979/D88789/D88788)

Reviewed By: mkazantsev

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


Compare: https://github.com/llvm/llvm-project/compare/9a33f027ac7d...1fb610429308


More information about the All-commits mailing list