[all-commits] [llvm/llvm-project] cfdc96: [Instcombine] Fix uses of undef (PR46940)

kazutakahirata via All-commits all-commits at lists.llvm.org
Tue Aug 11 14:25:21 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: cfdc96714bdfeabea31b1f4d2e0c65e424933994
      https://github.com/llvm/llvm-project/commit/cfdc96714bdfeabea31b1f4d2e0c65e424933994
  Author: Kazu Hirata <kazu at google.com>
  Date:   2020-08-11 (Tue, 11 Aug 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    A llvm/test/Transforms/InstCombine/dont-distribute-phi.ll

  Log Message:
  -----------
  [Instcombine] Fix uses of undef (PR46940)

Without this patch, we attempt to distribute And over Xor even in
unsafe circumstances like so:

  undef & (true ^ true)  ==>  (undef & true) ^ (undef & true)

and evaluate it to undef instead of false.  Note that "true ^ true"
may show up implicitly with one true being part of a PHI node.

This patch fixes the problem by teaching SimplifyUsingDistributiveLaws
to not use undef as part of simplifications.

Reviewers: spatel, aqjune, nikic, lebedev.ri, fhahn, jdoerfert

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




More information about the All-commits mailing list