[llvm] [DSE] Introduce `eliminateRedundantStoresViaDominatingConditions` (PR #181709)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 01:49:19 PST 2026


================
@@ -0,0 +1,196 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt < %s -aa-pipeline=basic-aa -passes='dse,verify<memoryssa>' -S | FileCheck %s
+
+; There exists a dominating condition in the entry block, not the immediate
+; dominator for the store, the edge entry->if.eq dominates the store, no
+; clobber in between, the store is redundant.
+define void @remove_tautological_store_via_dom_condition(ptr %x, i1 %c) {
----------------
antoniofrighetto wrote:

Sounds good, thanks, to be addressed as a follow-up (if it's okay to merge this before). (I had supposed this might be solvable with canReplacePointersInUseIfEqual, though, for some reason, I thought the API might have been too permissive here, and not be sufficient for this case).

https://github.com/llvm/llvm-project/pull/181709


More information about the llvm-commits mailing list