diff options
author | Florian Hahn <flo@fhahn.com> | 2024-11-19 22:01:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-19 22:01:16 +0000 |
commit | 076513646cfd922b42ea0e87e2f07397a3ff41a4 (patch) | |
tree | e49979e5c7edece643c49fa4fe92c81425e027a9 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 1c1fbf51b5ec9657e5da7fa94ee892273255544a (diff) | |
download | llvm-076513646cfd922b42ea0e87e2f07397a3ff41a4.zip llvm-076513646cfd922b42ea0e87e2f07397a3ff41a4.tar.gz llvm-076513646cfd922b42ea0e87e2f07397a3ff41a4.tar.bz2 |
[Local] Only intersect llvm.access.group metadata if instr moves. (#115868)
Preserve llvm.access.group metadata on the replacement instruction, if
it does not move. In that case, the program would be UB, if the parallel
property encoded in the metadata does not hold.
This matches the LangRef recently updated in #116220
PR https://github.com/llvm/llvm-project/pull/115868
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 509b6d6..6cbfa12 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -3336,8 +3336,9 @@ void llvm::combineMetadata(Instruction *K, const Instruction *J, K->setMetadata(Kind, MDNode::intersect(JMD, KMD)); break; case LLVMContext::MD_access_group: - K->setMetadata(LLVMContext::MD_access_group, - intersectAccessGroups(K, J)); + if (DoesKMove) + K->setMetadata(LLVMContext::MD_access_group, + intersectAccessGroups(K, J)); break; case LLVMContext::MD_range: if (DoesKMove || !K->hasMetadata(LLVMContext::MD_noundef)) |