[PATCH] D27114: Preserve nonnull metadata on Loads through SROA & mem2reg.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 07:53:03 PST 2017


spatel added a comment.

I'm not familiar with this code, but I'd like to see this functionality, so any assistance in reviewing is appreciated.
Other than the inline comment, this is good now?



================
Comment at: lib/Transforms/Scalar/SROA.cpp:2391-2404
+      SmallVector<std::pair<unsigned, MDNode *>, 8> MD;
+      LI.getAllMetadata(MD);
+      // Try to preserve as much metadata as possible
+      for (const auto &MDPair : MD) {
+        unsigned ID = MDPair.first;
+        MDNode *N = MDPair.second;
+        switch (ID) {
----------------
Is the intent to extend this for some subset of metadata types beyond just MD_nonnull? 

Either way, just make this one line for now?
NewLI->copyMetadata(LI, LLVMContext::MD_nonnull);


https://reviews.llvm.org/D27114





More information about the llvm-commits mailing list