[all-commits] [llvm/llvm-project] f65c88: [GlobalOpt] Fix memset handling in global ctor eva...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Jun 27 09:35:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f65c88c42fdd0e46d16fe31737e6627c56de77c3
      https://github.com/llvm/llvm-project/commit/f65c88c42fdd0e46d16fe31737e6627c56de77c3
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-06-27 (Mon, 27 Jun 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/Evaluator.h
    M llvm/lib/Transforms/Utils/Evaluator.cpp
    M llvm/test/Transforms/GlobalOpt/ctor-memset.ll

  Log Message:
  -----------
  [GlobalOpt] Fix memset handling in global ctor evaluation (PR55859)

The global ctor evaluator currently handles by checking whether the
memset memory is already zero, and skips it in that case. However,
it only actually checks the first byte of the memory being set.

This patch extends the code to check all bytes being set. This is
done byte-by-byte to avoid converting undef values to zeros in
larger reads. However, the handling is still not completely correct,
because there might still be padding bytes (though probably this
doesn't matter much in practice, as I'd expect global variable
padding to be zero-initialized in practice).

Mostly fixes https://github.com/llvm/llvm-project/issues/55859.

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




More information about the All-commits mailing list