Preserve more MD_mem_parallel_loop_access and MD_access_group in SROA
authorAndy Kaylor <andrew.kaylor@intel.com>
Thu, 10 Jun 2021 00:02:53 +0000 (17:02 -0700)
committerAndy Kaylor <andrew.kaylor@intel.com>
Thu, 10 Jun 2021 22:47:03 +0000 (15:47 -0700)
commit41555eaf65b12db00c8a18e7fe530f72ab9ebfc0
tree8029078f8ec2305ae08ad0c250cb7a3528119ce4
parent462f8f06113616ac5646144972d3f453639aac69
Preserve more MD_mem_parallel_loop_access and MD_access_group in SROA

SROA sometimes preserves MD_mem_parallel_loop_access and MD_access_group metadata on loads/stores, and sometimes fails to do so. This change adds copying of the MD after other CreateAlignedLoad/CreateAlignedStores. Also fix a case where the metadata was being copied from a load, rather than the store.

Added a LIT test to catch one case.

Patch by Mark Mendell

Differential Revision: https://reviews.llvm.org/D103254
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/test/Transforms/SROA/mem-par-metadata-sroa-cast.ll [new file with mode: 0644]