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

Roman Lebedev via All-commits all-commits at lists.llvm.org
Mon Dec 14 14:09:58 PST 2020


  Branch: refs/heads/release/11.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 934376da585156885eca2f38f021367a4981d981
      https://github.com/llvm/llvm-project/commit/934376da585156885eca2f38f021367a4981d981
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-14 (Mon, 14 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.

(cherry picked from commit f16320b90b8381f2e3aac1ec17f39eff06f09ea0)


  Commit: 8511a8df838f8b2766e56c22af4992d9862835fc
      https://github.com/llvm/llvm-project/commit/8511a8df838f8b2766e56c22af4992d9862835fc
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-14 (Mon, 14 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

(cherry picked from commit e6f2a79d7aa01f8dd7f0194f97a50b480e8ede71)


Compare: https://github.com/llvm/llvm-project/compare/fc23bc9b30bf...8511a8df838f


More information about the All-commits mailing list