[clang] [CIR][NFC] Use CleanupKindAttr predicates in FlattenCFG (PR #221234)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 14 23:22:47 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Henrich Lauko (xlauko)
<details>
<summary>Changes</summary>
`flattenCleanup` still checks the cleanup kind by comparing the raw enum against `Normal`, `EH` and `All`. `CleanupKindAttr::isNormal()` and `isEH()` mean exactly that, and the rest of `FlattenCFG` already calls `isEH()` since #<!-- -->224829.
Assisted-by: Claude Code (Claude Opus 5.5).
---
Full diff: https://github.com/llvm/llvm-project/pull/221234.diff
1 Files Affected:
- (modified) clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp (+3-5)
``````````diff
diff --git a/clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp b/clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp
index 4005124a054ac2..2787b57adad6ed 100644
--- a/clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp
@@ -1449,11 +1449,9 @@ class CIRCleanupScopeOpFlattening
llvm::SmallVectorImpl<cir::ResumeOp> &resumeOpsToChain,
mlir::PatternRewriter &rewriter) const {
mlir::Location loc = cleanupOp.getLoc();
- cir::CleanupKind cleanupKind = cleanupOp.getCleanupKind();
- bool hasNormalCleanup = cleanupKind == cir::CleanupKind::Normal ||
- cleanupKind == cir::CleanupKind::All;
- bool hasEHCleanup = cleanupKind == cir::CleanupKind::EH ||
- cleanupKind == cir::CleanupKind::All;
+ cir::CleanupKindAttr cleanupKind = cleanupOp.getCleanupKindAttr();
+ bool hasNormalCleanup = cleanupKind.isNormal();
+ bool hasEHCleanup = cleanupKind.isEH();
bool isMultiExit = exits.size() > 1;
// If every exit from the body is a musttail return, nothing reaches the
``````````
</details>
https://github.com/llvm/llvm-project/pull/221234
More information about the cfe-commits
mailing list