[llvm] [DeadStoreElimination] Optimize tautological assignments (PR #75744)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 01:16:18 PST 2024


================
@@ -795,3 +795,65 @@ join:
   store i8 %v, ptr %q, align 1
   ret void
 }
+
+; If the condition ensures that the value is already present in
+; in the variable, treat the store as noop and optimize. Should
+; not optimize stores if a clobber happens after the load that
+; is used in condition check.
+define void @remove_tautological_store(ptr %x, ptr %y, ptr %z) {
----------------
nikic wrote:

Please split this into separate tests. You first want one test where the transform succeeds, and then you want a sequence of tests based on the first one where *exactly one* of the preconditions for the transform fails.

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


More information about the llvm-commits mailing list