[LLVMdev] Aliasing caused by MemCpyOptimizer (PR18304)

David Wiberg dwiberg at gmail.com
Sun Jun 15 04:57:16 PDT 2014


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



More information about the llvm-dev mailing list