[llvm] Remove an invalid FIXME in a MemCpyOpt test (PR #200809)

Ömer Sinan Ağacan via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 06:09:34 PDT 2026


https://github.com/osa1 created https://github.com/llvm/llvm-project/pull/200809

Call slot optimization explicitly [requires `writable` and `noalias`][0] when the destination is an argument, and `sret` doesn't imply any of these.

So the `memcpy` into the return value pointer cannot be optimized away in this test.

The test for doing this optimization when the `sret` argument is also `writable` and `noalias` is [here][1].

Relevant commits:

- 369c9b791bc3f380e884bcad444287998c32ae16 requires writability in call slot optimization and adds the `writable` attribute in the test linked above, which already has `sret`, so that it optimizes as before. So `sret` does not imply `writable`.

- f445e39ab271d07733f0f45048badd9e58905aec updates `isWritable` used in the commit above to check for `noalias` on arguments before concluding "writable".

The FIXME should probably have been removed with one of these commits.

[0]: https://github.com/llvm/llvm-project/blob/356d7e6bf429a7ff3ae798bb994631ef33891a44/llvm/lib/Analysis/AliasAnalysis.cpp#L1009-L1019

[1]: https://github.com/llvm/llvm-project/blob/356d7e6bf429a7ff3ae798bb994631ef33891a44/llvm/test/Transforms/MemCpyOpt/sret.ll#L9

>From 78bca94c4c0a345b0891e0a303e8cc1b30591ea4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= <omeragacan at gmail.com>
Date: Mon, 1 Jun 2026 13:56:46 +0100
Subject: [PATCH] Remove an invalid FIXME in a MemCpyOpt test

Call slot optimization explicitly [requires `writable` and `noalias`][0]
when the destination is an argument, and `sret` doesn't imply any of
these.

So the `memcpy` into the return value pointer cannot be optimized away
in this test.

The test for doing this optimization when the `sret` argument is also
`writable` and `noalias` is [here][1].

Relevant commits:

- 369c9b791bc3f380e884bcad444287998c32ae16 requires writability in call
  slot optimization and adds the `writable` attribute in the test linked
  above, which already has `sret`, so that it optimizes as before. So
  `sret` does not imply `writable`.

- f445e39ab271d07733f0f45048badd9e58905aec updates `isWritable` used in
  the commit above to check for `noalias` on arguments before concluding
  "writable".

The FIXME should probably have been removed with one of these commits.

[0]: https://github.com/llvm/llvm-project/blob/356d7e6bf429a7ff3ae798bb994631ef33891a44/llvm/lib/Analysis/AliasAnalysis.cpp#L1009-L1019

[1]: https://github.com/llvm/llvm-project/blob/356d7e6bf429a7ff3ae798bb994631ef33891a44/llvm/test/Transforms/MemCpyOpt/sret.ll#L9
---
 llvm/test/Transforms/MemCpyOpt/memcpy.ll | 1 -
 1 file changed, 1 deletion(-)

diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy.ll b/llvm/test/Transforms/MemCpyOpt/memcpy.ll
index 937b3bf281034..49c7807ecea3e 100644
--- a/llvm/test/Transforms/MemCpyOpt/memcpy.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memcpy.ll
@@ -19,7 +19,6 @@ declare void @llvm.memcpy.inline.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1
 declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind
 
 ; Check that one of the memcpy's are removed.
-;; FIXME: PR 8643 We should be able to eliminate the last memcpy here.
 define void @test1(ptr sret(%0)  %agg.result, x86_fp80 %z.0, x86_fp80 %z.1) nounwind  {
 ; CHECK-LABEL: @test1(
 ; CHECK-NEXT:  entry:



More information about the llvm-commits mailing list