[all-commits] [llvm/llvm-project] f16320: [NFC][InstCombine] Add test coverage for @llvm.uad...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Wed Dec 9 07:24:29 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f16320b90b8381f2e3aac1ec17f39eff06f09ea0
      https://github.com/llvm/llvm-project/commit/f16320b90b8381f2e3aac1ec17f39eff06f09ea0
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-09 (Wed, 09 Dec 2020)

  Changed paths:
    M llvm/test/Transforms/InstCombine/saturating-add-sub.ll

  Log Message:
  -----------
  [NFC][InstCombine] Add test coverage for @llvm.uadd.sat canonicalization

The non-strict variants are already handled because they are canonicalized
to strict variants by swapping hands in both the select and icmp,
and the fold simply considers that strictness is irrelevant here.

But that isn't actually true for the last pattern, as PR48390 reports.


  Commit: e6f2a79d7aa01f8dd7f0194f97a50b480e8ede71
      https://github.com/llvm/llvm-project/commit/e6f2a79d7aa01f8dd7f0194f97a50b480e8ede71
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-09 (Wed, 09 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/saturating-add-sub.ll

  Log Message:
  -----------
  [InstCombine] canonicalizeSaturatedAdd(): last fold is only valid for strict comparison (PR48390)

We could create uadd.sat under incorrect circumstances
if a select with -1 as the false value was canonicalized
by swapping the T/F values. Unlike the other transforms
in the same function, it is not invariant to equality.

Some alive proofs: https://alive2.llvm.org/ce/z/emmKKL

Based on original patch by David Green!

Fixes https://bugs.llvm.org/show_bug.cgi?id=48390

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


Compare: https://github.com/llvm/llvm-project/compare/398f29fbb08b...e6f2a79d7aa0


More information about the All-commits mailing list