https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/139154
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/andykaylor approved this pull request.
lgtm
https://github.com/llvm/llvm-project/pull/139154
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Andres-Salamanca updated
https://github.com/llvm/llvm-project/pull/139154
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Ari
https://github.com/Andres-Salamanca updated
https://github.com/llvm/llvm-project/pull/139154
>From 803abd7bfa9aa48ba3446e6de8ffb1f20b16ec26 Mon Sep 17 00:00:00 2001
From: Andres Salamanca
Date: Thu, 8 May 2025 15:39:49 -0500
Subject: [PATCH 1/7] Add support for FlattenCFG switch and introduce
@@ -962,6 +964,102 @@ bool
cir::SwitchOp::isSimpleForm(llvm::SmallVectorImpl &cases) {
});
}
+//===--===//
+// SwitchFlatOp
+//===--===//
@@ -171,6 +171,234 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
https://github.com/Andres-Salamanca updated
https://github.com/llvm/llvm-project/pull/139154
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Ari
@@ -962,6 +964,102 @@ bool
cir::SwitchOp::isSimpleForm(llvm::SmallVectorImpl &cases) {
});
}
+//===--===//
+// SwitchFlatOp
+//===--===//
@@ -171,6 +171,234 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
https://github.com/andykaylor edited
https://github.com/llvm/llvm-project/pull/139154
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/andykaylor approved this pull request.
Looks good with just a couple of nits.
https://github.com/llvm/llvm-project/pull/139154
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cf
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
https://github.com/Andres-Salamanca updated
https://github.com/llvm/llvm-project/pull/139154
>From f77464dbe1de51c89fbde5e5decfc2314cd7dba6 Mon Sep 17 00:00:00 2001
From: Andres Salamanca
Date: Thu, 8 May 2025 15:39:49 -0500
Subject: [PATCH 1/5] Add support for FlattenCFG switch and introduce
Andres-Salamanca wrote:
> This is also missing a end-to-end test that proves we generate switchflatop
> if we are coming all the way from source code. There are examples in the
> incubator on how to check if a pass runs (you can use print-before/after) and
> the IR for it.
In the incubator, t
https://github.com/Andres-Salamanca updated
https://github.com/llvm/llvm-project/pull/139154
>From f77464dbe1de51c89fbde5e5decfc2314cd7dba6 Mon Sep 17 00:00:00 2001
From: Andres Salamanca
Date: Thu, 8 May 2025 15:39:49 -0500
Subject: [PATCH 1/4] Add support for FlattenCFG switch and introduce
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
https://github.com/Andres-Salamanca updated
https://github.com/llvm/llvm-project/pull/139154
>From f77464dbe1de51c89fbde5e5decfc2314cd7dba6 Mon Sep 17 00:00:00 2001
From: Andres Salamanca
Date: Thu, 8 May 2025 15:39:49 -0500
Subject: [PATCH 1/3] Add support for FlattenCFG switch and introduce
https://github.com/Andres-Salamanca updated
https://github.com/llvm/llvm-project/pull/139154
>From f77464dbe1de51c89fbde5e5decfc2314cd7dba6 Mon Sep 17 00:00:00 2001
From: Andres Salamanca
Date: Thu, 8 May 2025 15:39:49 -0500
Subject: [PATCH 1/2] Add support for FlattenCFG switch and introduce
@@ -971,6 +971,52 @@ def SwitchOp : CIR_Op<"switch",
}];
}
+//===--===//
+// SwitchFlatOp
+//===--===//
+
+def SwitchFlatOp : CIR_Op<"switc
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
@@ -0,0 +1,68 @@
+// RUN: cir-opt %s | FileCheck %s
+!s32i = !cir.int
+
+cir.func @FlatSwitchWithoutDefault(%arg0: !s32i) {
+ cir.switch.flat %arg0 : !s32i, ^bb2 [
+1: ^bb1
+ ]
+ ^bb1:
+cir.br ^bb2
+ ^bb2:
+cir.return
+}
+
+// CHECK: cir.switch.flat %arg0 : !s32i,
https://github.com/bcardosolopes commented:
This is also missing a end-to-end test that proves we generate switchflatop if
we are coming all the way from source code. There are examples in the incubator
on how to check if a pass runs (you can use print-before/after) and the IR for
it.
https:/
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/139154
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -971,6 +971,52 @@ def SwitchOp : CIR_Op<"switch",
}];
}
+//===--===//
+// SwitchFlatOp
+//===--===//
+
+def SwitchFlatOp : CIR_Op<"switc
@@ -971,6 +971,52 @@ def SwitchOp : CIR_Op<"switch",
}];
}
+//===--===//
+// SwitchFlatOp
+//===--===//
+
+def SwitchFlatOp : CIR_Op<"switc
@@ -962,6 +963,102 @@ bool
cir::SwitchOp::isSimpleForm(llvm::SmallVectorImpl &cases) {
});
}
+//===--===//
+// SwitchFlatOp
+//===--===//
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public
mlir::OpRewritePattern {
}
};
+class CIRSwitchOpFlattening : public mlir::OpRewritePattern {
+public:
+ using OpRewritePattern::OpRewritePattern;
+
+ inline void rewriteYieldOp(mlir::PatternRewriter &rewriter,
+
Andres-Salamanca wrote:
@andykaylor
https://github.com/llvm/llvm-project/pull/139154
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: None (Andres-Salamanca)
Changes
This PR adds support for the `FlattenCFG` transformation on `switch`
statements. It also introduces the `SwitchFlatOp`, which is necessary for
subsequent lowering to LLVM.
---
Patch is 28.96 KiB, truncat
llvmbot wrote:
@llvm/pr-subscribers-clangir
Author: None (Andres-Salamanca)
Changes
This PR adds support for the `FlattenCFG` transformation on `switch`
statements. It also introduces the `SwitchFlatOp`, which is necessary for
subsequent lowering to LLVM.
---
Patch is 28.96 KiB, trunc
https://github.com/Andres-Salamanca created
https://github.com/llvm/llvm-project/pull/139154
This PR adds support for the `FlattenCFG` transformation on `switch`
statements. It also introduces the `SwitchFlatOp`, which is necessary for
subsequent lowering to LLVM.
>From f77464dbe1de51c89fbde
36 matches
Mail list logo