[all-commits] [llvm/llvm-project] fde8eb: [InstCombine] visitMaskedMerge(): when unfolding, ...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Sun May 17 12:54:51 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: fde8eb00e1466cecd0fc6697f8c2ab837c5b7cf3
      https://github.com/llvm/llvm-project/commit/fde8eb00e1466cecd0fc6697f8c2ab837c5b7cf3
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-05-17 (Sun, 17 May 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/test/Transforms/InstCombine/unfold-masked-merge-with-const-mask-vector.ll

  Log Message:
  -----------
  [InstCombine] visitMaskedMerge(): when unfolding, sanitize undef constants (PR45955)

We can't leave undef vector element constants as-is,
it is a miscompile, so we need to sanitize them.

We have two vectors (C and ~C):
* We can't replace undef with 0 in both of them
* We can't replace undef with 0 in only one of them
* We could replace undef with -1 in both of them
* We could replace undef with -1 in only one(!) of them
* We could replace undef with -1 in one and 0 in another one of them.

Therefore, it seems best to go with the last option, since otherwise
we'd loose knowledge that C and ~C have no common bits set,
which seems more important than preserving partial undef knowledge.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45955




More information about the All-commits mailing list