[LLVMdev] Aliasing caused by MemCpyOptimizer (PR18304)

Maciej Piechotka uzytkownik2 at gmail.com
Sat Jun 21 07:54:36 PDT 2014


On Sun, 2014-06-15 at 13:57 +0200, David Wiberg wrote:
> Hello all,
> 
> PR18304 show an example where MemCpyOptimizer can cause pointers to
> alias. Adding a requirement that the called function does not capture
> the source pointer fixes the issue but it will also decrease the
> number of opportunities for the transform.
> 
> Does this seem like the correct direction for a fix?
> Will it be too restrictive?
> 
> Among the regression tests the proposed change causes failures in the
> following files:
> LLVM :: Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll
> LLVM :: Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll
> LLVM :: Transforms/MemCpyOpt/loadstore-sret.ll
> LLVM :: Transforms/MemCpyOpt/memcpy.ll
> LLVM :: Transforms/MemCpyOpt/sret.ll
> 
> If the solution seems correct my idea is to add the "nocapture"
> attribute to the functions called in the test files (assuming they
> don't capture the source pointer) to get the same test behavior as
> before.
> 
> Best regards
> David

I'm not sure about LLVM coding/patch standards but I imagine that adding
a regression test in the patch might be nice.

Best regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140621/1afe387e/attachment.sig>


More information about the llvm-dev mailing list