From d7c21364a92a035e20d89928e2b0ee60e35e64a7 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Tue, 21 Oct 2014 21:02:19 +0000 Subject: Teach combineMetadata how to merge 'nonnull' metadata. combineMetadata is used when merging two instructions into one. This change teaches it how to merge 'nonnull' - i.e. only preserve it on the new instruction if it's set on both sources. This isn't actually used yet since I haven't adjusted any of the call sites to pass in nonnull as a 'known metadata'. llvm-svn: 220325 --- llvm/lib/Transforms/Utils/Local.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/Transforms/Utils') diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index ecbe94a7e39..ef54eb20446 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1339,6 +1339,10 @@ void llvm::combineMetadata(Instruction *K, const Instruction *J, ArrayRefsetMetadata(Kind, JMD); break; + case LLVMContext::MD_nonnull: + // Only set the !nonnull if it is present in both instructions. + K->setMetadata(Kind, JMD); + break; } } } -- cgit v1.2.3