[clang] [CIR][NFC] Simplify BoolAttr builders (PR #136366)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 18 15:48:15 PDT 2025


================
@@ -456,9 +456,7 @@ mlir::LogicalResult CIRGenFunction::emitForStmt(const ForStmt &s) {
             // scalar type.
             condVal = evaluateExprAsBool(s.getCond());
           } else {
-            cir::BoolType boolTy = cir::BoolType::get(b.getContext());
-            condVal = b.create<cir::ConstantOp>(
-                loc, boolTy, cir::BoolAttr::get(b.getContext(), boolTy, true));
+            condVal = b.create<cir::ConstantOp>(loc, builder.getTrueAttr());
----------------
andykaylor wrote:

```suggestion
            condVal = b.getTrue();
```
Does this work?

https://github.com/llvm/llvm-project/pull/136366


More information about the cfe-commits mailing list