[PATCH] D26811: [MemCpyOpt] Don't sink LoadInst below possible clobber.

bryant via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 17 12:38:38 PST 2016


bryant added a comment.

For the sake of clarity, I've broken down the precise sequence of
transformations.

1. Original:

  ``` val = load A store _, B      ; may-alias A store _, C      ; may-alias A + D store val, D ```

2. Lift `store val, D` and its dependents and clobbers above the store to B:

  ``` store _, C      ; may-alias A + D val = load A store val, D store _, B      ; may-alias A ```

3. Implicitly lower the load to its counterpart store (this is the bug):

  ``` store _, C      ; may-alias A + D store val, D val = load A store _, B      ; may-alias A ```

4. Replace the load and store with a memcpy:

  ``` store _, C      ; may-alias A + D memcpy(D, A) store _, B      ; may-alias A ```


Repository:
  rL LLVM

https://reviews.llvm.org/D26811





More information about the llvm-commits mailing list