[PATCH] D19549: Fold compares irrespective of whether allocation can be elided

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 13:50:44 PDT 2016


majnemer added inline comments.

================
Comment at: lib/Analysis/CaptureTracking.cpp:313
@@ +312,3 @@
+      // Comparison against value stored in global variable.
+      unsigned OtherIndex = (I->getOperand(0) == V)? 1:0;
+      auto *LI = dyn_cast<LoadInst>(I->getOperand(OtherIndex));
----------------
Please format this appropriately.

================
Comment at: lib/Analysis/InstructionSimplify.cpp:2087-2092
@@ -2085,1 +2086,8 @@
 
+  // True when V is neither NULL pointer nor a NULL value loaded
+  auto isNonNullValue = [](Value *V) {
+    if (auto *LI = dyn_cast<LoadInst>(V))
+      return LI->getMetadata(LLVMContext::MD_nonnull) != NULL;
+    return !isa<ConstantPointerNull>(V);
+  };
+
----------------
Why not use `isKnownNonNull` or `isKnownNonNullAt` ?	


Repository:
  rL LLVM

http://reviews.llvm.org/D19549





More information about the llvm-commits mailing list