[all-commits] [llvm/llvm-project] 188171: [InstCombine] Remove memset of undef value

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Apr 29 05:51:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1881711fbb7b0cd1b8d492b3ca4b70ce75824030
      https://github.com/llvm/llvm-project/commit/1881711fbb7b0cd1b8d492b3ca4b70ce75824030
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-04-29 (Fri, 29 Apr 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
    M llvm/test/Transforms/InstCombine/memset.ll
    M llvm/test/Transforms/InstCombine/store.ll

  Log Message:
  -----------
  [InstCombine] Remove memset of undef value

This removes memset with undef char. We already do this for stores
of undef value.

This comes with the caveat that this optimization is not, strictly
speaking, legal for undef values, because we might be overwriting
a poison value. However, our entire load/store model currently still
operates on undef values, so we need to support undef here as well
for internal consistency.

Once https://github.com/llvm/llvm-project/issues/52930 is resolved,
these and related folds can be limited to poison -- I've added
FIXMEs to that effect.

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




More information about the All-commits mailing list