[all-commits] [llvm/llvm-project] b7c6fd: [CIR] Support addr-of-label in constant initialize...

Julius Alexandre via All-commits all-commits at lists.llvm.org
Sat Mar 14 05:18:02 PDT 2026


  Branch: refs/heads/users/julius/cir-addr-label-const
  Home:   https://github.com/llvm/llvm-project
  Commit: b7c6fd35493140efc2ee3e961debc985fcfad94a
      https://github.com/llvm/llvm-project/commit/b7c6fd35493140efc2ee3e961debc985fcfad94a
  Author: wizardengineer <juliuswoosebert at gmail.com>
  Date:   2026-03-14 (Sat, 14 Mar 2026)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
    M clang/test/CIR/CodeGen/label-values.c

  Log Message:
  -----------
  [CIR] Support addr-of-label in constant initializer context

Previously, using the GNU address-of-label extension (&&label) in an
array initializer like `void *labels[] = {&&a, &&b}` would hit an NYI
error in ConstantLValueEmitter::VisitAddrLabelExpr.

The scalar expression path already handles &&label correctly via
BlockAddressOp. The fix is to return null from the constant emitter,
which makes the caller fall through to the non-constant initialization
path that emits individual BlockAddressOp stores per element.

This is consistent with CIR's approach of preferring non-constant
emission to preserve source-level semantics (see CIRGenDecl.cpp:278).



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