[all-commits] [llvm/llvm-project] a22c99: [InstCombine] canonicalize cmp-of-bitcast-of-vecto...

RotateRight via All-commits all-commits at lists.llvm.org
Sat Jul 31 10:52:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a22c99c3c187bf30717b191503dab5726d3476aa
      https://github.com/llvm/llvm-project/commit/a22c99c3c187bf30717b191503dab5726d3476aa
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-07-31 (Sat, 31 Jul 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/test/Transforms/InstCombine/icmp-vec.ll
    M llvm/test/Transforms/PhaseOrdering/X86/vector-reductions-logical.ll

  Log Message:
  -----------
  [InstCombine] canonicalize cmp-of-bitcast-of-vector-cmp to use zero constant

We can invert a compare constant and preserve the logic
as shown in this sampling:
https://alive2.llvm.org/ce/z/YAXbfs
(In theory, we could deal with non-all-ones/zero as well,
but it doesn't seem worthwhile.)

I noticed this as a part of the x86 codegen difference in
https://llvm.org/PR51259 - it ends up using "test"
instead of "not + cmp" in that example.

This pattern also shows up in https://llvm.org/PR41312
and https://llvm.org/PR50798 .

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




More information about the All-commits mailing list