[all-commits] [llvm/llvm-project] 9ca2c3: [InstSimplify] Fix poison safety in insertvalue fold

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Feb 16 00:40:01 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9ca2c309ab0678fae48f96131b92754d0978c130
      https://github.com/llvm/llvm-project/commit/9ca2c309ab0678fae48f96131b92754d0978c130
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-02-16 (Thu, 16 Feb 2023)

  Changed paths:
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/test/Transforms/Inline/pr50270.ll
    M llvm/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll
    M llvm/test/Transforms/InstSimplify/insertvalue.ll

  Log Message:
  -----------
  [InstSimplify] Fix poison safety in insertvalue fold

We can only fold insertvalue undef, (extractvalue x, n) to x
if x is not poison, otherwise we might be replacing undef with
poison (https://alive2.llvm.org/ce/z/fnw3c8). The insertvalue
poison case is always fine.

I didn't go to particularly large effort to preserve cases where
folding with undef is still legal (mainly when there is a chain of
multiple inserts that end up covering the whole aggregate),
because this shouldn't really occur in practice: We should always
be generating the insertvalue poison form when constructing
aggregates nowadays.

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




More information about the All-commits mailing list