[all-commits] [llvm/llvm-project] b5ddcb: [ConstantRange] TestAddWithNo*WrapExhaustive: chec...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Wed Nov 6 14:31:03 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b5ddcb9f1e41b142f89110fc9be78b3c6997f090
      https://github.com/llvm/llvm-project/commit/b5ddcb9f1e41b142f89110fc9be78b3c6997f090
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2019-11-07 (Thu, 07 Nov 2019)

  Changed paths:
    M llvm/unittests/IR/ConstantRangeTest.cpp

  Log Message:
  -----------
  [ConstantRange] TestAddWithNo*WrapExhaustive: check that all overflow means empty set

As disscussed in https://reviews.llvm.org/D69918 / https://reviews.llvm.org/D67339
that is an implied postcondition, but it's not really fully tested.


  Commit: 365d729e1075a9391b7520306d8d9beee84d52b5
      https://github.com/llvm/llvm-project/commit/365d729e1075a9391b7520306d8d9beee84d52b5
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2019-11-07 (Thu, 07 Nov 2019)

  Changed paths:
    M llvm/lib/IR/ConstantRange.cpp

  Log Message:
  -----------
  [ConstantRange] Cleanup addWithNoWrap() by just piggybacking on sadd_sat()/uadd_sat()

As discussed in https://reviews.llvm.org/D69918
that happens to work as intended, and returns empty set if
there is always an overflow because we get lucky with intersection.
Since there's now an explicit test for that, let's prefer cleaner code.


  Commit: 7fbe5d4b2ab905792158669149ae4f547761ac9c
      https://github.com/llvm/llvm-project/commit/7fbe5d4b2ab905792158669149ae4f547761ac9c
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2019-11-07 (Thu, 07 Nov 2019)

  Changed paths:
    M llvm/include/llvm/IR/ConstantRange.h
    M llvm/lib/IR/ConstantRange.cpp
    M llvm/unittests/IR/ConstantRangeTest.cpp

  Log Message:
  -----------
  [ConstantRange] Add `subWithNoWrap()` method

Summary:
Much like D67339, adds ConstantRange handling for
when we know no-wrap behavior of the `sub`.

Unlike addWithNoWrap(), we only get lucky re returning empty set
for signed wrap. For unsigned, we must perform overflow check manually.

A patch that makes use of this in LVI (CVP) to be posted later.

Reviewers: nikic, shchenz, efriedma

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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


Compare: https://github.com/llvm/llvm-project/compare/76aee8a38944...7fbe5d4b2ab9


More information about the All-commits mailing list