[all-commits] [llvm/llvm-project] 8a0e35: [MemoryLocation] Don't require nocapture in getFor...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Dec 22 03:20:36 PST 2021

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a0e35f3a78d314d4661ff740a35e590f07b3297
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2021-12-22 (Wed, 22 Dec 2021)

  Changed paths:
    M llvm/lib/Analysis/MemoryLocation.cpp
    M llvm/test/Transforms/DeadStoreElimination/trivial-dse-calls.ll
    M llvm/test/Transforms/InstCombine/trivial-dse-calls.ll

  Log Message:
  [MemoryLocation] Don't require nocapture in getForDest()

As reames mentioned on related reviews, we don't need the nocapture
requirement here. First of all, from an API perspective, this is
not something that MemoryLocation::getForDest() should be checking
in the first place, because it does not affect which memory this
particular call can access; it's an orthogonal concern that should
be handled by the caller if necessary.

However, for both of the motivating users in DSE and InstCombine,
we don't need the nocapture requirement, because the capture can
either be purely local to the call (a pointer identity check that
is irrelevant to us), be part of the return value (which we check
is unused), or be written in the dest location, which we have
determined to be dead.

This allows us to remove the special handling for libcalls as well.

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

More information about the All-commits mailing list