[all-commits] [llvm/llvm-project] 65dc78: [InstCombine] Remove one-use limitation from X-Y==...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Feb 23 00:37:46 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 65dc78d63ee2eb20fbed54401091f08a685ef8c1
      https://github.com/llvm/llvm-project/commit/65dc78d63ee2eb20fbed54401091f08a685ef8c1
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp-sub.ll
    M llvm/test/Transforms/InstCombine/prevent-cmp-merge.ll
    M llvm/test/Transforms/InstCombine/result-of-usub-is-non-zero-and-no-overflow.ll

  Log Message:
  -----------
  [InstCombine] Remove one-use limitation from X-Y==0 fold

This one-use limitation is artificial, we do not increase
instruction count if we perform the fold with multiple uses. The
motivating case is shown in @sub_eq_zero_select, where the one-use
limitation causes us to miss a subsequent select fold.

I believe the backend is pretty good about reusing flag-producing
subs for cmps with same operands, so I think doing this is fine.

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




More information about the All-commits mailing list