[all-commits] [llvm/llvm-project] c7e3c1: [CIR] Simplify indirect-goto label tracking

adams381 via All-commits all-commits at lists.llvm.org
Thu Jun 25 10:41:58 PDT 2026


  Branch: refs/heads/users/adams381/cir-computed-goto-blockaddress
  Home:   https://github.com/llvm/llvm-project
  Commit: c7e3c11cfccdaab36b14cf3dcaddca3a18b14f54
      https://github.com/llvm/llvm-project/commit/c7e3c11cfccdaab36b14cf3dcaddca3a18b14f54
  Author: Adam Smith <adams at nvidia.com>
  Date:   2026-06-25 (Thu, 25 Jun 2026)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
    M clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
    M clang/lib/CIR/CodeGen/CIRGenFunction.cpp
    M clang/lib/CIR/CodeGen/CIRGenFunction.h
    M clang/lib/CIR/CodeGen/CIRGenModule.cpp
    M clang/lib/CIR/CodeGen/CIRGenModule.h
    M clang/lib/CIR/CodeGen/CIRGenStmt.cpp
    M clang/test/CIR/CodeGen/goto-address-label-table.c
    M clang/test/CIR/CodeGen/label-values.c

  Log Message:
  -----------
  [CIR] Simplify indirect-goto label tracking

Track every address-taken label -- whether `&&label` appears as an
operation or in a constant initializer -- in one per-function vector of
BlockAddrInfoAttr, resolved to its LabelOp in finishIndirectBranch. This
drops the BlockAddressOp->LabelOp map and the unresolved/resolved
bookkeeping in CIRGenModule: a label always resolves once every label has
been emitted, so the op-side deferral was unnecessary.

Create the indirect-branch block only when a `goto *expr` is emitted,
instead of the first time a label address is taken. A function that takes
a label address but never branches indirectly now emits no indirect
branch, rather than a dead one the verifier needs poisoned, so the poison
fallback is gone too. Classic codegen still emits the dead indirectbr for
that case, so the two diverge there; goto-address-label-table.c (h) and
label-values.c (E) cover it.



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