[all-commits] [llvm/llvm-project] 9d57a7: [X86] combineCMP - fold cmpEQ/NE(TRUNC(X), 0) -> cm...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Thu Apr 15 05:56:18 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9d57a77b81265c650c75511115067588790d7ac0
      https://github.com/llvm/llvm-project/commit/9d57a77b81265c650c75511115067588790d7ac0
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2021-04-15 (Thu, 15 Apr 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/and-with-overflow.ll
    M llvm/test/CodeGen/X86/pr34137.ll
    M llvm/test/CodeGen/X86/pr49028.ll
    M llvm/test/CodeGen/X86/setcc-logic.ll
    M llvm/test/CodeGen/X86/vector-compare-any_of.ll
    M llvm/test/CodeGen/X86/vector-reduce-and-cmp.ll
    M llvm/test/CodeGen/X86/vector-reduce-or-bool.ll

  Log Message:
  -----------
  [X86] combineCMP - fold cmpEQ/NE(TRUNC(X),0) -> cmpEQ/NE(X,0)

If we are truncating from a i32 source before comparing the result against zero, then see if we can directly compare the source value against zero.

If the upper (truncated) bits are known to be zero then we can compare against that, hopefully increasing the chances of us folding the compare into a EFLAG result of the source's operation.

Fixes PR49028.

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




More information about the All-commits mailing list