[all-commits] [llvm/llvm-project] f74990: [InstCombine] Avoid moving ops that do restrict un...

Florian Hahn via All-commits all-commits at lists.llvm.org
Wed Nov 13 05:40:59 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f7499011ca29bebeda7c9d79d79b290cf0b8b46d
      https://github.com/llvm/llvm-project/commit/f7499011ca29bebeda7c9d79d79b290cf0b8b46d
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2019-11-13 (Wed, 13 Nov 2019)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/vec_shuffle.ll

  Log Message:
  -----------
  [InstCombine] Avoid moving ops that do restrict undef across shuffles.

I think we have to be a bit more careful when it comes to moving
ops across shuffles, if the op does restrict undef. For example, without
this patch, we would move 'and %v, <0, 0, -1, -1>' over a
'shufflevector %a, undef, <undef, undef, 1, 2>'. As a result, the first
2 lanes of the result are undef after the combine, but they really
should be 0, unless I am missing something.

For ops that do fold to undef on undef operands, the current behavior
should be fine. I've add conservative check OpDoesRestrictUndef, maybe
there's a better existing utility?

Reviewers: spatel, RKSimon, lebedev.ri

Reviewed By: spatel

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




More information about the All-commits mailing list