@@ -428,6 +428,46 @@ def ScopeOp : CIR_Op<"scope", [
];
}
+//===--===//
+// BrOp
+//===--===//
+
+def BrOp : CIR_Op<"br",
@@ -280,6 +280,25 @@ def CIR_BoolType :
}];
}
+//===--===//
+// ArrayType
+//===--===//
+
+def CIR_ArrayType : CIR_Type<"Array", "array",
+
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/129072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -117,6 +117,24 @@ static void
printOmittedTerminatorRegion(mlir::OpAsmPrinter &printer,
/*printBlockTerminators=*/!omitRegionTerm(region));
}
+//===--===//
+// AllocaOp
+//===
@@ -0,0 +1,82 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apac
https://github.com/bcardosolopes approved this pull request.
LGTM pending on question left in one comment
https://github.com/llvm/llvm-project/pull/130690
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/li
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/130690
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir
-emit-cir %s -o %t.cir
bcardosolopes wrote:
Has this been addressed?
https://github.com/llvm/llvm-project/pull/130690
___
cfe
@@ -0,0 +1,166 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -11,6 +11,9 @@ add_clang_library(clangCIRFrontendAction
DEPENDS
MLIRCIROpsIncGen
MLIRCIROpInterfacesIncGen
+ # Add mlir-generic-headers dependency as the header CIRGenAction.h needs to
+ # include BuiltinOps.h
+ mlir-generic-headers
bcardosolopes wr
@@ -1,7 +1,9 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-llvm %s -o %
bcardosolopes wrote:
Looks like ready to land, @mmha do you have landing permission?
https://github.com/llvm/llvm-project/pull/129072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/130869
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value
-fclangir -emit-llvm %s -o
https://github.com/bcardosolopes approved this pull request.
https://github.com/llvm/llvm-project/pull/130869
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes approved this pull request.
https://github.com/llvm/llvm-project/pull/131369
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes approved this pull request.
https://github.com/llvm/llvm-project/pull/131057
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes approved this pull request.
https://github.com/llvm/llvm-project/pull/131181
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes closed
https://github.com/llvm/llvm-project/pull/131057
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -52,6 +52,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
return cir::BoolAttr::get(getContext(), getBoolTy(), state);
}
+ /// Create a for operation.
+ cir::ForOp createFor(
+ mlir::Location loc,
+ llvm::function_ref condBuilder,
https://github.com/bcardosolopes approved this pull request.
LGTM, the only difference from incubator is the misleading comment, thanks
Andy! Will update comment over there as well.
https://github.com/llvm/llvm-project/pull/132269
___
cfe-commits mail
https://github.com/bcardosolopes approved this pull request.
LGTM after nit
https://github.com/llvm/llvm-project/pull/132468
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -143,6 +147,114 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
return createCast(loc, cir::CastKind::bitcast, src, newTy);
}
+ mlir::Value createBinop(mlir::Value lhs, cir::BinOpKind kind,
+ const llvm::APInt &rhs) {
+return create(
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/132420
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes approved this pull request.
I don't have anything else to add, LGTM!
https://github.com/llvm/llvm-project/pull/132974
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listin
@@ -710,6 +710,89 @@ class ScalarExprEmitter : public
StmtVisitor {
HANDLEBINOP(Xor)
HANDLEBINOP(Or)
#undef HANDLEBINOP
+
+ mlir::Value emitCmp(const BinaryOperator *e) {
+mlir::Value result;
+QualType lhsTy = e->getLHS()->getType();
+QualType rhsTy = e->getRH
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/132974
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes approved this pull request.
LGTM after other reviews are applied.
https://github.com/llvm/llvm-project/pull/134181
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/
https://github.com/bcardosolopes approved this pull request.
Thanks for the updates, LGTM!
https://github.com/llvm/llvm-project/pull/133100
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm
@@ -759,6 +761,84 @@ def BrCondOp : CIR_Op<"brcond",
}];
}
+//===--===//
+// While & DoWhileOp
+//===--===//
+
+class WhileOpBase : CIR_Op
@@ -759,6 +762,46 @@ LogicalResult cir::BinOp::verify() {
return mlir::success();
}
+//===--===//
+// ShiftOp
+//===--===//
+LogicalResult
@@ -1117,6 +1117,91 @@ mlir::LogicalResult
CIRToLLVMBinOpLowering::matchAndRewrite(
return mlir::LogicalResult::success();
}
+mlir::LogicalResult CIRToLLVMShiftOpLowering::matchAndRewrite(
+cir::ShiftOp op, OpAdaptor adaptor,
+mlir::ConversionPatternRewriter &rewrit
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/133405
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes requested changes to this pull request.
Looks reasonable to add vector support later for shifts. Because `SelectOp` is
independent of `ShiftOp`, one possibility would have been to split it in two
PRs to land them faster, but wouldn't bother changing for this rou
@@ -405,3 +405,45 @@ float fpPostInc2() {
// OGCG: store float %[[A_INC]], ptr %[[A]], align 4
// OGCG: store float %[[A_LOAD]], ptr %[[B]], align 4
// OGCG: %[[B_TO_OUTPUT:.*]] = load float, ptr %[[B]], align 4
+
+_Float16 fp16UPlus(_Float16 f) {
+ return +f;
+}
+
+// C
@@ -405,3 +405,45 @@ float fpPostInc2() {
// OGCG: store float %[[A_INC]], ptr %[[A]], align 4
// OGCG: store float %[[A_LOAD]], ptr %[[B]], align 4
// OGCG: %[[B_TO_OUTPUT:.*]] = load float, ptr %[[B]], align 4
+
+_Float16 fp16UPlus(_Float16 f) {
+ return +f;
+}
+
+// C
@@ -265,3 +265,125 @@ void test_empty_while_true() {
// OGCG: br label %[[WHILE_BODY:.*]]
// OGCG: [[WHILE_BODY]]:
// OGCG: ret void
+
+void unreachable_after_continue() {
+ for (;;) {
+continue;
+int x = 1;
+ }
+}
+
+// CIR: cir.func @unreachable_after_continue
+
@@ -265,3 +265,125 @@ void test_empty_while_true() {
// OGCG: br label %[[WHILE_BODY:.*]]
// OGCG: [[WHILE_BODY]]:
// OGCG: ret void
+
+void unreachable_after_continue() {
+ for (;;) {
+continue;
+int x = 1;
+ }
+}
+
+// CIR: cir.func @unreachable_after_continue
+
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/133829
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -135,6 +135,55 @@ mlir::Location CIRGenFunction::getLoc(mlir::Location lhs,
mlir::Location rhs) {
return mlir::FusedLoc::get(locs, metadata, &getMLIRContext());
}
+bool CIRGenFunction::ContainsLabel(const Stmt *s, bool ignoreCaseStmts) {
bcardosolopes wr
@@ -135,6 +135,55 @@ mlir::Location CIRGenFunction::getLoc(mlir::Location lhs,
mlir::Location rhs) {
return mlir::FusedLoc::get(locs, metadata, &getMLIRContext());
}
+bool CIRGenFunction::ContainsLabel(const Stmt *s, bool ignoreCaseStmts) {
+ // Null statement, not a label
bcardosolopes wrote:
@Andres-Salamanca thanks for working on this. We usually write tests that
exercise any possible different paths codegen can take. For next rounds: it's
fine if you add less things in one go and make it more incremental with the use
of (a) errorNYI and (b) assert on missing
@@ -263,6 +264,72 @@ static void terminateBody(CIRGenBuilderTy &builder,
mlir::Region &r,
b->erase();
}
+mlir::LogicalResult CIRGenFunction::emitIfStmt(const IfStmt &s) {
+ mlir::LogicalResult res = mlir::success();
+ // The else branch of a consteval if statement is al
@@ -442,6 +457,25 @@ class CIRGenFunction : public CIRGenTypeCache {
mlir::LogicalResult emitDeclStmt(const clang::DeclStmt &s);
LValue emitDeclRefLValue(const clang::DeclRefExpr *e);
+ /// Emit an if on a boolean condition to the specified blocks.
+ /// FIXME: Based on
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/134333
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -263,6 +264,72 @@ static void terminateBody(CIRGenBuilderTy &builder,
mlir::Region &r,
b->erase();
}
+mlir::LogicalResult CIRGenFunction::emitIfStmt(const IfStmt &s) {
+ mlir::LogicalResult res = mlir::success();
+ // The else branch of a consteval if statement is al
@@ -462,6 +462,58 @@ def ReturnOp : CIR_Op<"return", [ParentOneOf<["FuncOp",
"ScopeOp", "DoWhileOp",
let hasVerifier = 1;
}
+//===--===//
+// IfOp
+//===-
@@ -193,8 +334,23 @@ LValue CIRGenFunction::emitUnaryOpLValue(const
UnaryOperator *e) {
switch (op) {
case UO_Deref: {
-cgm.errorNYI(e->getSourceRange(), "UnaryOp dereference");
-return LValue();
+QualType t = e->getSubExpr()->getType()->getPointeeType();
+
https://github.com/bcardosolopes approved this pull request.
LGTM pending discussion with Eli
https://github.com/llvm/llvm-project/pull/134317
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c
https://github.com/bcardosolopes commented:
I have only minor inline comments, good direction.
The PR is a bit big but I can see this requires touching everywhere in CIRGen
and also LLVM lowering support, which is good end-to-end testing.
If there are things there are not needed right now, it'
@@ -32,6 +32,16 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
return create(loc, attr.getType(), attr);
}
+ cir::ConstantOp getConstantInt(mlir::Location loc, mlir::Type ty,
+ int64_t value) {
+return create(loc, ty, cir::IntAt
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/132974
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -229,6 +236,40 @@ def CastOp : CIR_Op<"cast",
let hasFolder = 1;
}
+
+//===--===//
+// PtrStrideOp
+//===--===//
+
+def PtrStrideOp : CI
https://github.com/bcardosolopes approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/133017
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -67,6 +67,40 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
return create(loc, attr.getType(), attr);
}
+ mlir::TypedAttr getConstNullPtrAttr(mlir::Type t) {
+assert(mlir::isa(t) && "expected cir.ptr");
+return getConstPtrAttr(t, 0);
+ }
+
+ mlir::Typ
@@ -1117,6 +1118,122 @@ mlir::LogicalResult
CIRToLLVMBinOpLowering::matchAndRewrite(
return mlir::LogicalResult::success();
}
+mlir::LogicalResult CIRToLLVMBinOpOverflowOpLowering::matchAndRewrite(
+cir::BinOpOverflowOp op, OpAdaptor adaptor,
+mlir::ConversionPatter
https://github.com/bcardosolopes commented:
Overall looks fine!
https://github.com/llvm/llvm-project/pull/133100
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/133157
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes approved this pull request.
https://github.com/llvm/llvm-project/pull/133134
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes approved this pull request.
Looks straight-forward to me, one minor nit!
https://github.com/llvm/llvm-project/pull/133157
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/li
@@ -759,6 +761,84 @@ def BrCondOp : CIR_Op<"brcond",
}];
}
+//===--===//
+// While & DoWhileOp
+//===--===//
+
+class WhileOpBase : CIR_Op
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/133100
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes approved this pull request.
I don't have anything to add on top of Andy's review. LGTM once those comments
are addressed.
https://github.com/llvm/llvm-project/pull/133159
___
cfe-commits mailing list
cfe-commits@lists.
@@ -759,6 +761,84 @@ def BrCondOp : CIR_Op<"brcond",
}];
}
+//===--===//
+// While & DoWhileOp
+//===--===//
+
+class WhileOpBase : CIR_Op
bcardosolopes wrote:
> The git history says the FIXME about "Pure" was added when @cmarcelo
> introduced `UnaryOp` in the incubator, but there is no PR associated with the
> commit so I don't know what discussions may have taken place.
We floated the idea of implementing operators as part of `
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/132266
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/132420
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -293,7 +294,8 @@ void CIRGenFunction::startFunction(GlobalDecl gd, QualType
returnType,
mlir::Value addrVal =
emitAlloca(cast(paramVar)->getName(),
- convertType(paramVar->getType()), paramLoc, alignment);
+ convertType(param
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/132468
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bcardosolopes approved this pull request.
https://github.com/llvm/llvm-project/pull/132266
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
601 - 670 of 670 matches
Mail list logo