[all-commits] [llvm/llvm-project] 954597: Revert "[Clang] Propagate guaranteed alignment for...

James Y Knight via All-commits all-commits at lists.llvm.org
Tue Feb 8 11:35:16 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9545976ff160e19805a84a06a7e59d446f9994d9
  Author: James Y Knight <jyknight at google.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M clang/include/clang/Basic/TargetInfo.h
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/CodeGen/alloc-fns-alignment.c

  Log Message:
  Revert "[Clang] Propagate guaranteed alignment for malloc and others"

The above change assumed that malloc (and friends) would always
allocate memory to getNewAlign(), even for allocations which have a
smaller size. This is not actually required by spec (a 1-byte
allocation may validly have 1-byte alignment).

Some real-world malloc implementations do not provide this guarantee,
and thus this optimization is breaking programs.

Fixes #53540

This reverts commit c2297544c04764237cedc523083c7be2fb3833d4.

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

More information about the All-commits mailing list