[all-commits] [llvm/llvm-project] 0e84bf: [CIR] Handle the 'before case' block of a switch s...
Erich Keane via All-commits
all-commits at lists.llvm.org
Wed May 27 10:56:07 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0e84bfa79f1121b65609013175c6515159e3cdec
https://github.com/llvm/llvm-project/commit/0e84bfa79f1121b65609013175c6515159e3cdec
Author: Erich Keane <ekeane at nvidia.com>
Date: 2026-05-27 (Wed, 27 May 2026)
Changed paths:
M clang/lib/CIR/CodeGen/CIRGenStmt.cpp
M clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp
A clang/test/CIR/CodeGen/switch-pre-case-stmts.cpp
Log Message:
-----------
[CIR] Handle the 'before case' block of a switch statement. (#199752)
Before this patch, we would fail any time there was a block with
entry/exit (in this case, one with successors thanks to a label) with a
verification error. This patch adds special handling for that first
block.
This patch DOES choose to not trim them however. Unless there is a label
inside of the block, there isn't any way to get there, and it is dead
code. I've opted to NOT do that optimization, as I suspect that might be
valuable to future passes/something we may wish to warn about in some
sort of CFG analysis.
Additionally, there is some minor changes to FlattenCFG, first to make
sure we skip the switch ONLY if it is truly empty, and second to make
sure we transform any 'break' in the pre-case 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