[clang] [CIR] Add transform test for cir-flatten-cfg (PR #130861)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 12 07:45:04 PDT 2025
================
@@ -0,0 +1,58 @@
+// RUN: cir-opt %s -cir-flatten-cfg -o - | FileCheck %s
+
+module {
+ cir.func @foo() {
+ cir.scope {
+ %0 = cir.alloca !cir.int<u, 32>, !cir.ptr<!cir.int<u, 32>>, ["a", init] {alignment = 4 : i64}
+ %1 = cir.const #cir.int<4> : !cir.int<u, 32>
+ cir.store %1, %0 : !cir.int<u, 32>, !cir.ptr<!cir.int<u, 32>>
+ }
+ cir.return
+ }
+// CHECK: cir.func @foo() {
+// CHECK: cir.br ^bb1
----------------
erichkeane wrote:
This here is a touch awkward, right? I know we did a bit of work to remove 'empty' blocks in the pass. I wonder if a future version of this pass should be checking the 'exit' of a block to see if it is a single-out (that is, no decisions being done, just a single `br`, and merge the two. It seems to fit in well with the flatten.
That is, this function here seems like it should/could be a single block, right?
https://github.com/llvm/llvm-project/pull/130861
More information about the cfe-commits
mailing list