[all-commits] [llvm/llvm-project] 113479: [CIR] FlattenCFG: accept cir.trap as a ternary reg...
Bruno Cardoso Lopes via All-commits
all-commits at lists.llvm.org
Wed Apr 29 15:08:29 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 113479d119a997e4c4c3eae63e087588c9662121
https://github.com/llvm/llvm-project/commit/113479d119a997e4c4c3eae63e087588c9662121
Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
Date: 2026-04-29 (Wed, 29 Apr 2026)
Changed paths:
M clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp
M clang/test/CIR/Transforms/ternary.cir
Log Message:
-----------
[CIR] FlattenCFG: accept cir.trap as a ternary region terminator (#194497)
The CIRTernaryOpFlattening pattern only accepted cir.yield and
cir.unreachable as the terminator of a ternary region. Any other
terminator caused a verifier error ("unexpected terminator in ternary
false region") and aborted the backend with "IR failed to verify after
pattern application".
Real-world C++ code that uses the libc++ assertion macros hits this
path: _LIBCPP_ASSERT_NON_NULL expands to `cond ? (void)0 :
__builtin_trap()`, which lowers to a `cir.ternary` whose false region
ends in `cir.trap`. This is structurally identical to the
`cir.unreachable` case (both are non-returning Terminators), so the
flattening pattern just needs to leave the trap in place rather than
trying to rewrite it into a branch to the continue block.
Concretely this is blocking ~1,510 libc++ tests (~17% of the suite) that
all failed with the same diagnostic at construct_at.h, sample.h, and
pop_heap.h.
Extends clang/test/CIR/Transforms/ternary.cir with regression coverage
for cir.trap (true and false region) and cir.unreachable (false region).
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