[all-commits] [llvm/llvm-project] 4c8dbe: Allow calls with known writes when trying to remov...
Philip Reames via All-commits
all-commits at lists.llvm.org
Thu Dec 16 11:04:53 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4c8dbe96d748440b1724d86c77efd9c890a48990
https://github.com/llvm/llvm-project/commit/4c8dbe96d748440b1724d86c77efd9c890a48990
Author: Philip Reames <listmail at philipreames.com>
Date: 2021-12-16 (Thu, 16 Dec 2021)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
A llvm/test/Transforms/InstCombine/trivial-dse-calls.ll
Log Message:
-----------
Allow calls with known writes when trying to remove allocas
isAllocSiteRemovable tracks whether all uses of an alloca are both non-capturing, and non-reading. If so, we can remove said alloca because nothing can depend on its content or address.
This patch extends this reasoning to allow writes from calls where we can prove the call has no side effect other than writing to said allocation. This is a fairly natural fit for the existing code with one subtle detail - the call can write to multiple locations at once which stores can't.
As a follow up, we can likely sink the intrinsic handling into the generic code by allowing readnone arguments as well. I deliberately left that out to minimize conceptual churn.
Differential Revision: https://reviews.llvm.org/D115829
More information about the All-commits
mailing list