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

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 12:02:30 PDT 2016


sanjoy requested changes to this revision.
sanjoy added a comment.
This revision now requires changes to proceed.

I think we cannot fold comparisons with values loaded from globals, since the global we're loading from could contain null.  Maybe we need to use `!nonnull` metadata?


================
Comment at: lib/Analysis/CaptureTracking.cpp:312
@@ -311,1 +311,3 @@
             break;
+      // Comparison against global pointer.
+      unsigned OtherIndex = (I->getOperand(0) == V)? 1:0;
----------------
Nit: I'd rephrase this as "Comparison against value stored in global variable"

================
Comment at: lib/Analysis/InstructionSimplify.cpp:2091
@@ +2090,3 @@
+  // The dynamic allocation call could be either of the operands.
+  Value *MI = NULL;
+  if (isAllocLikeFn(LHS, TLI) && !isa<ConstantPointerNull>(RHS))
----------------
Nit: use `nullptr`


Repository:
  rL LLVM

http://reviews.llvm.org/D19549





More information about the llvm-commits mailing list