[all-commits] [llvm/llvm-project] 164410: [CodeGen] -fno-delete-null-pointer-checks: change ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Nov 30 12:49:28 PST 2020


  Branch: refs/heads/temp-test-main
  Home:   https://github.com/llvm/llvm-project
  Commit: 164410324d8bf3b5a99e39f7dfe3c6d6972dab30
      https://github.com/llvm/llvm-project/commit/164410324d8bf3b5a99e39f7dfe3c6d6972dab30
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-11-30 (Mon, 30 Nov 2020)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/test/CodeGenCXX/this-nonnull.cpp

  Log Message:
  -----------
  [CodeGen] -fno-delete-null-pointer-checks: change dereferenceable to dereferenceable_or_null

After D17993, with -fno-delete-null-pointer-checks we add the dereferenceable attribute to the `this` pointer.

We have observed that one internal target which worked before fails even with -fno-delete-null-pointer-checks.
Switching to dereferenceable_or_null fixes the problem.

dereferenceable currently does not always respect NullPointerIsValid and may
imply nonnull and lead to aggressive optimization. The optimization may be
related to `CallBase::isReturnNonNull`, `Argument::hasNonNullAttr`, or
`Value::getPointerDereferenceableBytes`. See D66664 and D66618 for some discussions.

Reviewed By: bkramer, rsmith

Differential Revision: https://reviews.llvm.org/D92297




More information about the All-commits mailing list