[llvm] r220325 - Teach combineMetadata how to merge 'nonnull' metadata.

Philip Reames listmail at philipreames.com
Tue Oct 21 14:02:19 PDT 2014


Author: reames
Date: Tue Oct 21 16:02:19 2014
New Revision: 220325

URL: http://llvm.org/viewvc/llvm-project?rev=220325&view=rev
Log:
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'.  


Modified:
    llvm/trunk/lib/Transforms/Utils/Local.cpp

Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=220325&r1=220324&r2=220325&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Tue Oct 21 16:02:19 2014
@@ -1339,6 +1339,10 @@ void llvm::combineMetadata(Instruction *
         // Only set the !invariant.load if it is present in both instructions.
         K->setMetadata(Kind, JMD);
         break;
+      case LLVMContext::MD_nonnull:
+        // Only set the !nonnull if it is present in both instructions.
+        K->setMetadata(Kind, JMD);
+        break;
     }
   }
 }





More information about the llvm-commits mailing list