[PATCH] D17993: [CodeGen] Apply 'nonnull' to 'this' pointer arguments.

Hal Finkel via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 9 08:01:08 PST 2016


hfinkel added a subscriber: hfinkel.
hfinkel added a comment.

I'm *really* nervous about doing anything with  -f(no-)delete-null-pointer-checks that makes it look like we support this feature without actually supporting it in the backend.

In computePointerICmp in InstructionSimplify.cpp, we have:

  // A non-null pointer is not equal to a null pointer.
  if (llvm::isKnownNonNull(LHS, TLI) && isa<ConstantPointerNull>(RHS) &&
      (Pred == CmpInst::ICMP_EQ || Pred == CmpInst::ICMP_NE))
    return ConstantInt::get(GetCompareTy(LHS),
                            !CmpInst::isTrueWhenEqual(Pred));

I'd much rather have the frontend add an attribute (and I think it must be an attribute because of how this needs to work in LTO) that disables this, and any other necessary checks.


http://reviews.llvm.org/D17993





More information about the cfe-commits mailing list