aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2024-11-26 20:39:53 +0000
committerGitHub <noreply@github.com>2024-11-26 20:39:53 +0000
commit46a08579f2b86e39b367b83ff4ca0e92302d2168 (patch)
tree3e12fe2ac38c6c11d58d0dfaab09bbe089b17380 /llvm/lib/Transforms/Utils/Local.cpp
parent0719b6d936d628c4c1765a9e700387ddd77759b9 (diff)
downloadllvm-46a08579f2b86e39b367b83ff4ca0e92302d2168.zip
llvm-46a08579f2b86e39b367b83ff4ca0e92302d2168.tar.gz
llvm-46a08579f2b86e39b367b83ff4ca0e92302d2168.tar.bz2
[Local] Only intersect alias.scope,noalias & parallel_loop if inst moves (#117716)
Preserve !alias.scope, !noalias and !mem.parallel_loop_access metadata on the replacement instruction, if it does not move. In that case, the program would be UB, if the aliasing property encoded in the metadata does not hold. This makes use of the clarification re aliasing metadata implying UB if the property does not hold: #116220 Same as #115868, but for !alias.scope, !noalias and !mem.parallel_loop_access. PR: https://github.com/llvm/llvm-project/pull/117716
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index d574095..e4bcedd 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -3330,11 +3330,13 @@ void llvm::combineMetadata(Instruction *K, const Instruction *J,
K->setMetadata(Kind, MDNode::getMostGenericTBAA(JMD, KMD));
break;
case LLVMContext::MD_alias_scope:
- K->setMetadata(Kind, MDNode::getMostGenericAliasScope(JMD, KMD));
+ if (DoesKMove)
+ K->setMetadata(Kind, MDNode::getMostGenericAliasScope(JMD, KMD));
break;
case LLVMContext::MD_noalias:
case LLVMContext::MD_mem_parallel_loop_access:
- K->setMetadata(Kind, MDNode::intersect(JMD, KMD));
+ if (DoesKMove)
+ K->setMetadata(Kind, MDNode::intersect(JMD, KMD));
break;
case LLVMContext::MD_access_group:
if (DoesKMove)