[all-commits] [llvm/llvm-project] 206089: [ConstantRange] Add exact union/intersect (NFC)

Nikita Popov via All-commits all-commits at lists.llvm.org
Sun Nov 7 12:49:11 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2060895c9ce71bba5a950827167f23ae9eb6eef5
      https://github.com/llvm/llvm-project/commit/2060895c9ce71bba5a950827167f23ae9eb6eef5
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-11-07 (Sun, 07 Nov 2021)

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

  Log Message:
  -----------
  [ConstantRange] Add exact union/intersect (NFC)

For some optimizations on comparisons it's necessary that the
union/intersect is exact and not a superset. Add methods that
return Optional<ConstantRange> only if the result is exact.

For the sake of simplicity this is implemented by comparing
the subset and superset approximations for now, but it should be
possible to do this more directly, as unionWith() and intersectWith()
already distinguish the cases where the result is imprecise for the
preferred range type functionality.




More information about the All-commits mailing list