[PATCH] D150970: [MemCpyOpt] Use memcpy source directly if dest is known to be immutable from attributes

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 7 08:21:32 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1685
+  if (writtenBetween(MSSA, BAA, MemoryLocation::getForSource(MDep),
+                     MSSA->getMemoryAccess(MDep), CallAccess))
+    return false;
----------------
I believe these `MSSA->getMemoryAccess(MDep)` calls can be replaced by `Clobber`.


================
Comment at: llvm/test/Transforms/MemCpyOpt/memcpy.ll:566
 ; CHECK-LABEL: @immut_param_enforced_alignment(
 ; CHECK-NEXT:    [[VAL:%.*]] = alloca i8, align 1
 ; CHECK-NEXT:    store i32 42, ptr [[VAL]], align 4
----------------
nikic wrote:
> Hm, so I expected that for this test case the transform would happen and change to `align 4` here. Do you know why it doesn't?
Hm, this does work when I test the patch locally, so maybe just outdated test result?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150970/new/

https://reviews.llvm.org/D150970



More information about the llvm-commits mailing list