[all-commits] [llvm/llvm-project] 514b00: [X86] Limit the scope of the min/max canonicalizat...

topperc via All-commits all-commits at lists.llvm.org
Fri Aug 7 22:52:12 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 514b00c43996221b90ce581bfb18b6af7caed5f6
      https://github.com/llvm/llvm-project/commit/514b00c43996221b90ce581bfb18b6af7caed5f6
  Author: Craig Topper <craig.topper at intel.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/8bit_cmov_of_trunc_promotion.ll
    M llvm/test/CodeGen/X86/atomic-minmax-i6432.ll
    M llvm/test/CodeGen/X86/atomic128.ll
    M llvm/test/CodeGen/X86/atomic32.ll
    M llvm/test/CodeGen/X86/atomic64.ll
    M llvm/test/CodeGen/X86/atomic6432.ll
    M llvm/test/CodeGen/X86/cmov.ll
    M llvm/test/CodeGen/X86/pr5145.ll

  Log Message:
  -----------
  [X86] Limit the scope of the min/max canonicalization in combineSelect

Previously the transform was doing these two canonicalizations
(x > y) ? x : y -> (x >= y) ? x : y
(x < y) ? x : y -> (x <= y) ? x : y

But those don't seem to be useful generally. And they actively
pessimize the cases in PR47049.

This patch limits it to
(x > 0) ? x : 0 -> (x >= 0) ? x : 0
(x < -1) ? x : -1 -> (x <= -1) ? x : -1

These are the cases mentioned in the comments as the motivation
for the canonicalization. These allow the CMOV to use the S
flag from the compare thus improving opportunities to use a TEST
or the flags from an arithmetic instruction.




More information about the All-commits mailing list