[all-commits] [llvm/llvm-project] 99f869: [Attributes] Remove nonnull from UB-implying attri...

Nikita Popov via All-commits all-commits at lists.llvm.org
Sun Jul 25 09:07:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 99f869c8f00a36dac3c774178b69d05876a29a31
      https://github.com/llvm/llvm-project/commit/99f869c8f00a36dac3c774178b69d05876a29a31
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-07-25 (Sun, 25 Jul 2021)

  Changed paths:
    M llvm/lib/IR/Attributes.cpp
    M llvm/test/Transforms/DeadArgElim/NoundefAttrs.ll
    M llvm/test/Transforms/InstCombine/unused-nonnull.ll

  Log Message:
  -----------
  [Attributes] Remove nonnull from UB-implying attributes

>From LangRef:

> if the parameter or return pointer is null, poison value is
> returned or passed instead. The nonnull attribute should be
> combined with the noundef attribute to ensure a pointer is not
> null or otherwise the behavior is undefined.

Dropping noundef is sufficient to prevent UB. Including nonnull
in this method just muddies the semantics.




More information about the All-commits mailing list