[all-commits] [llvm/llvm-project] 5737ce: [LangRef] Allow non-power-of-two assume operand bu...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Mar 23 07:53:48 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5737ce259bf5f07976d6f0440e08acd7016a42c8
      https://github.com/llvm/llvm-project/commit/5737ce259bf5f07976d6f0440e08acd7016a42c8
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-03-23 (Wed, 23 Mar 2022)

  Changed paths:
    M llvm/docs/LangRef.rst

  Log Message:
  -----------
  [LangRef] Allow non-power-of-two assume operand bundle

There has been a lot of confusion on this in the past (see for
example https://reviews.llvm.org/D110634 and earlier revisions),
so let's try to get some clarity here. This patch specifies that
a) specifying a non-constant assumed alignment is explicitly
allowed and b) an invalid (non-power-of-two) alignment is not UB,
but rather converts it into an assumption that the pointer is null.

This change is done for two reasons:
a) Assume operand bundles are specifically used in cases where the
alignment is not known during frontend codegen (otherwise we'd just
use an align attribute), so rejecting this case doesn't make sense.
b) At least for aligned_alloc the C standard specifies that passing
an invalid alignment results in a null pointer, not undefined
behavior.

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




More information about the All-commits mailing list