[PATCH] D33756: [RS4GC] Drop invalid metadata after pointers are relocated

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 31 20:56:57 PDT 2017


anna created this revision.

After RS4GC, we should drop metadata that is no longer valid. These metadata
is used by optimizations scheduled after RS4GC, and can cause a miscompile.
One such metadata is invariant.load which is used by LICM sinking transform.
After rewriting statepoints, the address of a load maybe relocated. With 
invariant.load metadata on a load instruction, LICM sinking assumes the 
loaded value (from a dererenceable address) to be invariant, and
rematerializes the load operand and the load at the exit block.
This transforms the IR to have an unrelocated use of the 
address after a statepoint, which is incorrect.

This patch drops the invariant.load metadata on load instructions after
rewriting statepoints.


https://reviews.llvm.org/D33756

Files:
  lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  test/Transforms/RewriteStatepointsForGC/drop-invalid-metadata.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33756.100962.patch
Type: text/x-patch
Size: 4328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170601/6e8fcb09/attachment.bin>


More information about the llvm-commits mailing list