[all-commits] [llvm/llvm-project] a22282: [InstCombine] make icmp vector canonicalization sa...

RotateRight via All-commits all-commits at lists.llvm.org
Tue Oct 29 07:58:20 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a22282be54b309ce7ab0e6bf8595893384971646
      https://github.com/llvm/llvm-project/commit/a22282be54b309ce7ab0e6bf8595893384971646
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2019-10-29 (Tue, 29 Oct 2019)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-eq-to-icmp-ule.ll
    M llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll
    M llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sle-to-icmp-sle.ll
    M llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-uge-to-icmp-ule.ll
    M llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ule-to-icmp-ule.ll
    M llvm/test/Transforms/InstCombine/icmp-vec.ll
    M llvm/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll

  Log Message:
  -----------
  [InstCombine] make icmp vector canonicalization safe for constant with undef elements

This is a fix for:
https://bugs.llvm.org/show_bug.cgi?id=43730
...and as shown there, we have existing test cases that show potential miscompiles.

We could just bail out for vector constants that contain any undef elements, or we can do as shown here:
allow the transform, but replace the undefs with a safe value.

For most of the tests shown, this results in a full splat constant (no undefs) which is probably a win
for further IR analysis because we conservatively don't match undefs in most cases. Codegen can probably
recover these kinds of undef lanes via demanded elements analysis if that's profitable.

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




More information about the All-commits mailing list