[clang] [CIR] Fix the cir.canonicalize test (PR #235078)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 23 13:03:15 PDT 2026
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/235078
https://github.com/llvm/llvm-project/pull/225814 changed how the core MLIR pattern rewriter handles unreachable blocks. The change missed a CIR test that produces different output after the change. This updates the test.
>From 119e120864c7c1174c69b6aa156444896538dc35 Mon Sep 17 00:00:00 2001
From: Andy Kaylor <akaylor at nvidia.com>
Date: Fri, 23 Oct 2026 12:59:38 -0700
Subject: [PATCH] [CIR] Fix the cir.canonicalize test
https://github.com/llvm/llvm-project/pull/225814 changed how the core
MLIR pattern rewriter handles unreachable blocks. The change missed a
CIR test that produces different output after the change. This updates
the test.
---
clang/test/CIR/Transforms/canonicalize.cir | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/clang/test/CIR/Transforms/canonicalize.cir b/clang/test/CIR/Transforms/canonicalize.cir
index a786b252e91ad6..b76d6b462eee01 100644
--- a/clang/test/CIR/Transforms/canonicalize.cir
+++ b/clang/test/CIR/Transforms/canonicalize.cir
@@ -45,7 +45,9 @@ module {
// In this unreachable cycle, ^header is the only predecessor of ^body and
// ^body the only predecessor of ^header, and ^body passes ^header's own
// argument back to it. ^header must not be merged into ^body: %keep would be
- // replaced by itself, and its use in the call would outlive ^header.
+ // replaced by itself, and its use in the call would outlive ^header. The
+ // greedy driver does not rewrite operations in unreachable blocks, so the
+ // cycle is left as written.
cir.func private @use(!s32i)
cir.func @no_merge_self_arg_loop(%arg0: !s32i) -> !s32i {
cir.return %arg0 : !s32i
@@ -59,6 +61,8 @@ module {
// CHECK-NEXT: cir.return %[[ARG0]] : !s32i
// CHECK-NEXT: ^[[HEADER:bb[0-9]+]](%[[KEEP:.*]]: !s32i):
// CHECK-NEXT: cir.call @use(%[[KEEP]]) : (!s32i) -> ()
+ // CHECK-NEXT: cir.br ^[[BODY:bb[0-9]+]]
+ // CHECK-NEXT: ^[[BODY]]:
// CHECK-NEXT: cir.br ^[[HEADER]](%[[KEEP]] : !s32i)
// CHECK-NEXT: }
More information about the cfe-commits
mailing list