[all-commits] [llvm/llvm-project] 682b08: Allow calls with known writes when trying to remov...

Philip Reames via All-commits all-commits at lists.llvm.org
Thu Dec 16 13:13:40 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 682b083bbd24a8a315b3afe2cae99b37dfaacf11
      https://github.com/llvm/llvm-project/commit/682b083bbd24a8a315b3afe2cae99b37dfaacf11
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

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

  Log Message:
  -----------
  Allow calls with known writes when trying to remove allocas [part 2]

This is a slight generalization of D115829. I noticed this while restructuring code for a follow up patch to perform the same optimizations in DSE.

If we have a call whose only visible effect is writing to an alloca, and we're removing the alloca anyways, we don't care if the call also reads from the same alloca. That read will be unobservable and thus doesn't block removal of the call.

Worth noting is that this observation generalizes for non-argument reads. It just happens that case reduces to a readonly call, and is already handled separately.

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




More information about the All-commits mailing list