[all-commits] [llvm/llvm-project] 85b27a: [ARM][AArch64] Add ARM specific builtin for clz th...

Craig Topper via All-commits all-commits at lists.llvm.org
Wed Jul 12 09:29:44 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 85b27ace52560da6f37d58a8460885adcf147c8b
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-07-12 (Wed, 12 Jul 2023)

  Changed paths:
    M clang/include/clang/Basic/BuiltinsAArch64.def
    M clang/include/clang/Basic/BuiltinsARM.def
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/Headers/arm_acle.h

  Log Message:
  [ARM][AArch64] Add ARM specific builtin for clz that is not undefined for 0 in ubsan.

D152023 made ubsan consider __builtin_clz of 0 undefined regardless of
the target. This ensures portability and matches gcc.

This causes the ACLE intrinsics to also be considered to also be
considered to be undefined for 0 since they used the generic builtins
as their implementation.

This patch adds builtins for ARM that ubsan doesn't know about to make
the behavior defined for 0. Alternatively, I could have added a zero
check to the intrinsics, but the dedicated builtin will give better -O0

Fixes #63113.

Reviewed By: tmatheson

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

More information about the All-commits mailing list