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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 14:37:11 PST 2017


spatel added inline comments.


================
Comment at: lib/Transforms/Utils/PromoteMemoryToRegister.cpp:959-972
+      // If the load was marked as nonnull we don't want to lose
+      // that information when we erase this Load. So we preserve
+      // it with an assume.
+      if (AC && LI->getMetadata(LLVMContext::MD_nonnull)) {
+        Function *AssumeIntrinsic =
+            Intrinsic::getDeclaration(LI->getModule(), Intrinsic::assume);
+        ICmpInst *LoadNotNull = new ICmpInst(
----------------
Please make a helper function so we don't have duplicated code.


https://reviews.llvm.org/D27114





More information about the llvm-commits mailing list