[all-commits] [llvm/llvm-project] dac49e: [Arm] Fix generating code with UB in NeonEmitter (...

Momchil Velikov via All-commits all-commits at lists.llvm.org
Fri Jan 24 02:57:46 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dac49e8ddd5dc0104c238f09cdd532e6fb5c4f1d
      https://github.com/llvm/llvm-project/commit/dac49e8ddd5dc0104c238f09cdd532e6fb5c4f1d
  Author: Momchil Velikov <momchil.velikov at arm.com>
  Date:   2025-01-24 (Fri, 24 Jan 2025)

  Changed paths:
    M clang/utils/TableGen/NeonEmitter.cpp

  Log Message:
  -----------
  [Arm] Fix generating code with UB in NeonEmitter (#121802)

When generating `arm_neon.h`, NeonEmitter outputs code that
violates strict aliasing rules (C23 6.5 Expressions #7,
C++23 7.2.1 Value category [basic.lval] #11), for example:

    bfloat16_t __reint = __p0;
    uint32_t __reint1 = (uint32_t)(*(uint16_t *) &__reint) << 16;
    __ret = *(float32_t *) &__reint1;

This patch fixed the offending code by replacing it with
a call to `__builtin_bit_cast`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list