From 179c29675825e1880e090752ce71a8582a245702 Mon Sep 17 00:00:00 2001 From: xlauko Date: Sun, 28 Sep 2025 10:02:04 +0200 Subject: [PATCH] [CIR] Make all opt tests verify roundtrip This also fixes GlobalOp roundtrip. --- .../include/clang/CIR/Dialect/IR/CIRAttrs.td | 2 +- clang/include/clang/CIR/Dialect/IR/CIROps.td | 2 +- .../include/clang/CIR/Dialect/IR/CIRTypes.td | 2 +- clang/test/CIR/IR/address-space.cir | 3 +-- clang/test/CIR/IR/aliases.cir | 3 +-- clang/test/CIR/IR/alloca.cir | 2 +- clang/test/CIR/IR/annotations.cir | 3 +-- clang/test/CIR/IR/array.cir | 2 +- clang/test/CIR/IR/attribute.cir | 2 +- clang/test/CIR/IR/await.cir | 3 +-- clang/test/CIR/IR/being_and_nothingness.cir | 2 +- clang/test/CIR/IR/bit.cir | 2 +- clang/test/CIR/IR/block-adress.cir | 2 +- clang/test/CIR/IR/branch.cir | 2 +- clang/test/CIR/IR/builtins.cir | 2 +- clang/test/CIR/IR/call-op-call-conv.cir | 3 +-- clang/test/CIR/IR/call.cir | 2 +- clang/test/CIR/IR/cast.cir | 2 +- clang/test/CIR/IR/cir-ops.cir | 2 +- clang/test/CIR/IR/constptrattr.cir | 2 +- clang/test/CIR/IR/copy.cir | 3 ++- clang/test/CIR/IR/cxx-special-member.cir | 3 +-- clang/test/CIR/IR/data-member-ptr.cir | 2 +- clang/test/CIR/IR/do-while.cir | 3 +-- clang/test/CIR/IR/exceptions.cir | 2 +- clang/test/CIR/IR/float.cir | 2 +- clang/test/CIR/IR/for.cir | 3 +-- clang/test/CIR/IR/func-call-conv.cir | 3 +-- clang/test/CIR/IR/func-dsolocal-parser.cir | 2 +- clang/test/CIR/IR/func.cir | 2 +- clang/test/CIR/IR/getmember.cir | 3 +-- clang/test/CIR/IR/global.cir | 3 +-- clang/test/CIR/IR/inlineAttr.cir | 2 +- clang/test/CIR/IR/int.cir | 2 +- clang/test/CIR/IR/libc-fabs.cir | 3 ++- clang/test/CIR/IR/libc-memchr.cir | 3 ++- clang/test/CIR/IR/libc-memcpy.cir | 3 ++- clang/test/CIR/IR/llvm-intrinsic.cir | 3 +-- clang/test/CIR/IR/module.cir | 3 +-- clang/test/CIR/IR/ptr_stride.cir | 2 +- clang/test/CIR/IR/resume-location-parsing.cir | 2 +- clang/test/CIR/IR/scope.cir | 3 +-- clang/test/CIR/IR/side-effect.cir | 3 +-- clang/test/CIR/IR/stack-save-restore.cir | 2 +- clang/test/CIR/IR/struct.cir | 3 +-- clang/test/CIR/IR/switch.cir | 2 +- clang/test/CIR/IR/tbaa-parse.cir | 2 +- clang/test/CIR/IR/ternary.cir | 2 +- clang/test/CIR/IR/try.cir | 26 +++++++++---------- clang/test/CIR/IR/types.cir | 2 +- clang/test/CIR/IR/unreachable.cir | 3 +-- clang/test/CIR/IR/vtableAttr.cir | 11 ++++---- clang/test/CIR/IR/while.cir | 3 +-- 53 files changed, 73 insertions(+), 88 deletions(-) diff --git a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td index a05609405e9b..0e42de854351 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td @@ -974,7 +974,7 @@ def CIR_AddressSpaceAttr : CIR_EnumAttr { ]; let assemblyFormat = [{ - `` custom($value) + `(` custom($value) `)` }]; let defaultValue = "cir::AddressSpace::Default"; diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index e370943c4228..80b066f5163b 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -2544,7 +2544,7 @@ def CIR_GlobalOp : CIR_Op<"global", [ (`comdat` $comdat^)? ($tls_model^)? (`dso_local` $dso_local^)? - ( `addrspace` `(` $addr_space^ `)` )? + (`addrspace` `` $addr_space^)? $sym_name custom($sym_type, $initial_value, $ctorRegion, $dtorRegion) ($annotations^)? diff --git a/clang/include/clang/CIR/Dialect/IR/CIRTypes.td b/clang/include/clang/CIR/Dialect/IR/CIRTypes.td index 3dc9b3ac68a7..33abc3ffc66f 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRTypes.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRTypes.td @@ -256,7 +256,7 @@ def CIR_PointerType : CIR_Type<"Pointer", "ptr", [ let assemblyFormat = [{ `<` $pointee - ( `,` `addrspace` `(` custom($addrSpace)^ `)` )? + ( `,` `addrspace` `(` `` custom($addrSpace)^ `)` )? `>` }]; diff --git a/clang/test/CIR/IR/address-space.cir b/clang/test/CIR/IR/address-space.cir index 176cc6ca8c62..234d03fa19b8 100644 --- a/clang/test/CIR/IR/address-space.cir +++ b/clang/test/CIR/IR/address-space.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int diff --git a/clang/test/CIR/IR/aliases.cir b/clang/test/CIR/IR/aliases.cir index a330f315d404..62707c95d861 100644 --- a/clang/test/CIR/IR/aliases.cir +++ b/clang/test/CIR/IR/aliases.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s module { // CHECK: @testAnonRecordsAlias diff --git a/clang/test/CIR/IR/alloca.cir b/clang/test/CIR/IR/alloca.cir index 3c5b7ab6036e..80b756adb526 100644 --- a/clang/test/CIR/IR/alloca.cir +++ b/clang/test/CIR/IR/alloca.cir @@ -1,6 +1,6 @@ // Test the CIR operations can parse and print correctly (roundtrip) -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int !u64i = !cir.int diff --git a/clang/test/CIR/IR/annotations.cir b/clang/test/CIR/IR/annotations.cir index 454703e74563..1150d58d5266 100644 --- a/clang/test/CIR/IR/annotations.cir +++ b/clang/test/CIR/IR/annotations.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int module attributes {cir.global_annotations = diff --git a/clang/test/CIR/IR/array.cir b/clang/test/CIR/IR/array.cir index b69439924a41..3ff4957b6fb2 100644 --- a/clang/test/CIR/IR/array.cir +++ b/clang/test/CIR/IR/array.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u32i = !cir.int diff --git a/clang/test/CIR/IR/attribute.cir b/clang/test/CIR/IR/attribute.cir index 4c9d4083ad4a..a45151f387db 100644 --- a/clang/test/CIR/IR/attribute.cir +++ b/clang/test/CIR/IR/attribute.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s -split-input-file -allow-unregistered-dialect -verify-diagnostics | FileCheck %s +// RUN: cir-opt %s -split-input-file -allow-unregistered-dialect -verify-diagnostics --verify-roundtrip | FileCheck %s cir.func @float_attrs_pass() { "test.float_attrs"() { diff --git a/clang/test/CIR/IR/await.cir b/clang/test/CIR/IR/await.cir index c62e6b7b88b6..c1fb0d6d7c57 100644 --- a/clang/test/CIR/IR/await.cir +++ b/clang/test/CIR/IR/await.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s cir.func coroutine @checkPrintParse(%arg0 : !cir.bool) { cir.await(user, ready : { diff --git a/clang/test/CIR/IR/being_and_nothingness.cir b/clang/test/CIR/IR/being_and_nothingness.cir index 8dff3ba723b7..cd8cc98e3e4c 100644 --- a/clang/test/CIR/IR/being_and_nothingness.cir +++ b/clang/test/CIR/IR/being_and_nothingness.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s // Exercise different ways to encode a function returning void // This test is less useful that it used to be, because a redundant `!cir.void` // as a function return type is no longer supported. diff --git a/clang/test/CIR/IR/bit.cir b/clang/test/CIR/IR/bit.cir index ee49f79d4bbc..562a60b03c73 100644 --- a/clang/test/CIR/IR/bit.cir +++ b/clang/test/CIR/IR/bit.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s8i = !cir.int !s16i = !cir.int diff --git a/clang/test/CIR/IR/block-adress.cir b/clang/test/CIR/IR/block-adress.cir index ae9662461d08..a33ac151a3d4 100644 --- a/clang/test/CIR/IR/block-adress.cir +++ b/clang/test/CIR/IR/block-adress.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !void = !cir.void diff --git a/clang/test/CIR/IR/branch.cir b/clang/test/CIR/IR/branch.cir index 7f418908a94c..12bf7c093e62 100644 --- a/clang/test/CIR/IR/branch.cir +++ b/clang/test/CIR/IR/branch.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s cir.func @test_branch_parsing(%arg0: !cir.bool) { // CHECK: cir.br ^bb1 diff --git a/clang/test/CIR/IR/builtins.cir b/clang/test/CIR/IR/builtins.cir index 413119420be6..f7a6a652187d 100644 --- a/clang/test/CIR/IR/builtins.cir +++ b/clang/test/CIR/IR/builtins.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u32i = !cir.int module { diff --git a/clang/test/CIR/IR/call-op-call-conv.cir b/clang/test/CIR/IR/call-op-call-conv.cir index bf13cb76d947..7b418226cec1 100644 --- a/clang/test/CIR/IR/call-op-call-conv.cir +++ b/clang/test/CIR/IR/call-op-call-conv.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int !fnptr = !cir.ptr !s32i>> diff --git a/clang/test/CIR/IR/call.cir b/clang/test/CIR/IR/call.cir index abd2fe9ba878..be86fe461577 100644 --- a/clang/test/CIR/IR/call.cir +++ b/clang/test/CIR/IR/call.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int !fnptr = !cir.ptr !s32i>> diff --git a/clang/test/CIR/IR/cast.cir b/clang/test/CIR/IR/cast.cir index 890b4055dd6a..c3b26cf79756 100644 --- a/clang/test/CIR/IR/cast.cir +++ b/clang/test/CIR/IR/cast.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int module { diff --git a/clang/test/CIR/IR/cir-ops.cir b/clang/test/CIR/IR/cir-ops.cir index c59f5cda5c0c..dbd6690ed718 100644 --- a/clang/test/CIR/IR/cir-ops.cir +++ b/clang/test/CIR/IR/cir-ops.cir @@ -1,6 +1,6 @@ // Test the CIR operations can parse and print correctly (roundtrip) -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int !s8i = !cir.int !u64i = !cir.int diff --git a/clang/test/CIR/IR/constptrattr.cir b/clang/test/CIR/IR/constptrattr.cir index 21e14283b320..e6ec6df43a3f 100644 --- a/clang/test/CIR/IR/constptrattr.cir +++ b/clang/test/CIR/IR/constptrattr.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int diff --git a/clang/test/CIR/IR/copy.cir b/clang/test/CIR/IR/copy.cir index 9a689036985e..b8e371e8d9e6 100644 --- a/clang/test/CIR/IR/copy.cir +++ b/clang/test/CIR/IR/copy.cir @@ -1,8 +1,9 @@ -// RUN: cir-opt %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int module { cir.func @shouldParseCopyOp(%arg0 : !cir.ptr, %arg1 : !cir.ptr) { + // CHECK: cir.copy cir.copy %arg0 to %arg1 : !cir.ptr cir.return } diff --git a/clang/test/CIR/IR/cxx-special-member.cir b/clang/test/CIR/IR/cxx-special-member.cir index 8d0ceb16d3fc..26ca418a9980 100644 --- a/clang/test/CIR/IR/cxx-special-member.cir +++ b/clang/test/CIR/IR/cxx-special-member.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int !rec_S = !cir.record diff --git a/clang/test/CIR/IR/data-member-ptr.cir b/clang/test/CIR/IR/data-member-ptr.cir index 103c94ef7b7b..63b345de582d 100644 --- a/clang/test/CIR/IR/data-member-ptr.cir +++ b/clang/test/CIR/IR/data-member-ptr.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int !rec_Foo = !cir.record diff --git a/clang/test/CIR/IR/do-while.cir b/clang/test/CIR/IR/do-while.cir index 6664b4cfe4bf..195cf411607d 100644 --- a/clang/test/CIR/IR/do-while.cir +++ b/clang/test/CIR/IR/do-while.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s cir.func @testPrintingAndParsing (%arg0 : !cir.bool) -> !cir.void { cir.do { diff --git a/clang/test/CIR/IR/exceptions.cir b/clang/test/CIR/IR/exceptions.cir index 3940a663fdb4..acde8a64b2c4 100644 --- a/clang/test/CIR/IR/exceptions.cir +++ b/clang/test/CIR/IR/exceptions.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s // XFAIL: * !s32i = !cir.int diff --git a/clang/test/CIR/IR/float.cir b/clang/test/CIR/IR/float.cir index 1be52c339ad5..76a5075a8aef 100644 --- a/clang/test/CIR/IR/float.cir +++ b/clang/test/CIR/IR/float.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s // Adapted from mlir/test/IR/parser.mlir diff --git a/clang/test/CIR/IR/for.cir b/clang/test/CIR/IR/for.cir index 62b82976cc68..d7b8d27a4b00 100644 --- a/clang/test/CIR/IR/for.cir +++ b/clang/test/CIR/IR/for.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s cir.func @testPrintingParsing(%arg0 : !cir.bool) { cir.for : cond { diff --git a/clang/test/CIR/IR/func-call-conv.cir b/clang/test/CIR/IR/func-call-conv.cir index 331b8fa23d7a..e6f4c60317ac 100644 --- a/clang/test/CIR/IR/func-call-conv.cir +++ b/clang/test/CIR/IR/func-call-conv.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int diff --git a/clang/test/CIR/IR/func-dsolocal-parser.cir b/clang/test/CIR/IR/func-dsolocal-parser.cir index 4e4bbf3880d4..3b5a5bc20053 100644 --- a/clang/test/CIR/IR/func-dsolocal-parser.cir +++ b/clang/test/CIR/IR/func-dsolocal-parser.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int #fn_attr = #cir, nothrow = #cir.nothrow, optnone = #cir.optnone})> diff --git a/clang/test/CIR/IR/func.cir b/clang/test/CIR/IR/func.cir index 48981a216f9a..ef27a6412032 100644 --- a/clang/test/CIR/IR/func.cir +++ b/clang/test/CIR/IR/func.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int !u8i = !cir.int diff --git a/clang/test/CIR/IR/getmember.cir b/clang/test/CIR/IR/getmember.cir index b46d03f10da0..abec53ec169f 100644 --- a/clang/test/CIR/IR/getmember.cir +++ b/clang/test/CIR/IR/getmember.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u16i = !cir.int !u32i = !cir.int diff --git a/clang/test/CIR/IR/global.cir b/clang/test/CIR/IR/global.cir index 4c21d060e6e2..4020ddcaadf4 100644 --- a/clang/test/CIR/IR/global.cir +++ b/clang/test/CIR/IR/global.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s8i = !cir.int !s32i = !cir.int !s64i = !cir.int diff --git a/clang/test/CIR/IR/inlineAttr.cir b/clang/test/CIR/IR/inlineAttr.cir index 3d51efd2b258..15dbbb39e240 100644 --- a/clang/test/CIR/IR/inlineAttr.cir +++ b/clang/test/CIR/IR/inlineAttr.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s -check-prefix=CIR +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s -check-prefix=CIR // RUN: cir-opt %s -cir-to-llvm -o - | FileCheck %s -check-prefix=MLIR #fn_attr = #cir})> diff --git a/clang/test/CIR/IR/int.cir b/clang/test/CIR/IR/int.cir index af972da9340b..47fb0f4931c6 100644 --- a/clang/test/CIR/IR/int.cir +++ b/clang/test/CIR/IR/int.cir @@ -2,7 +2,7 @@ // cir.global external @a = #cir.int<255> : !cir.int // } -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s8i = !cir.int !s16i = !cir.int !s32i = !cir.int diff --git a/clang/test/CIR/IR/libc-fabs.cir b/clang/test/CIR/IR/libc-fabs.cir index 691849e0c3a5..2a644fb2a4b8 100644 --- a/clang/test/CIR/IR/libc-fabs.cir +++ b/clang/test/CIR/IR/libc-fabs.cir @@ -1,8 +1,9 @@ -// RUN: cir-opt %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u32i = !cir.int module { cir.func @foo(%arg0: !cir.double) -> !cir.double { + // CHECK: cir.fabs %0 = cir.fabs %arg0 : !cir.double cir.return %0 : !cir.double } diff --git a/clang/test/CIR/IR/libc-memchr.cir b/clang/test/CIR/IR/libc-memchr.cir index 014414322819..bc746bb9db21 100644 --- a/clang/test/CIR/IR/libc-memchr.cir +++ b/clang/test/CIR/IR/libc-memchr.cir @@ -1,10 +1,11 @@ -// RUN: cir-opt %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !voidptr = !cir.ptr !s32i = !cir.int !u64i = !cir.int module { cir.func @f(%src : !voidptr, %pattern : !s32i, %len : !u64i) -> !voidptr { + // CHECK: cir.libc.memchr %ptr = cir.libc.memchr(%src, %pattern, %len) cir.return %ptr : !voidptr } diff --git a/clang/test/CIR/IR/libc-memcpy.cir b/clang/test/CIR/IR/libc-memcpy.cir index 737f56d533e3..6769092f3beb 100644 --- a/clang/test/CIR/IR/libc-memcpy.cir +++ b/clang/test/CIR/IR/libc-memcpy.cir @@ -1,8 +1,9 @@ -// RUN: cir-opt %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u32i = !cir.int module { cir.func @shouldParseLibcMemcpyOp(%arg0 : !cir.ptr, %arg1 : !u32i) { + // CHECK: cir.libc.memcpy cir.libc.memcpy %arg1 bytes from %arg0 to %arg0 : !u32i, !cir.ptr -> !cir.ptr cir.return } diff --git a/clang/test/CIR/IR/llvm-intrinsic.cir b/clang/test/CIR/IR/llvm-intrinsic.cir index 687db64ee09b..f69721bb66b4 100644 --- a/clang/test/CIR/IR/llvm-intrinsic.cir +++ b/clang/test/CIR/IR/llvm-intrinsic.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int !s64i = !cir.int diff --git a/clang/test/CIR/IR/module.cir b/clang/test/CIR/IR/module.cir index 7ce2c0ba21cb..8c782fdb2dbc 100644 --- a/clang/test/CIR/IR/module.cir +++ b/clang/test/CIR/IR/module.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -split-input-file -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s -split-input-file --verify-roundtrip | FileCheck %s // Should parse and print C source language attribute. module attributes {cir.lang = #cir.lang} { } diff --git a/clang/test/CIR/IR/ptr_stride.cir b/clang/test/CIR/IR/ptr_stride.cir index 725c9b12d2e4..a2fd9823deed 100644 --- a/clang/test/CIR/IR/ptr_stride.cir +++ b/clang/test/CIR/IR/ptr_stride.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int module { diff --git a/clang/test/CIR/IR/resume-location-parsing.cir b/clang/test/CIR/IR/resume-location-parsing.cir index 30ce610c1a10..40d230fda130 100644 --- a/clang/test/CIR/IR/resume-location-parsing.cir +++ b/clang/test/CIR/IR/resume-location-parsing.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s // Test ClangIR exception handling parsing fix // This demonstrates the syntax that was failing before the fix: diff --git a/clang/test/CIR/IR/scope.cir b/clang/test/CIR/IR/scope.cir index 1828921a6fe0..a04c9024a868 100644 --- a/clang/test/CIR/IR/scope.cir +++ b/clang/test/CIR/IR/scope.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u32i = !cir.int module { diff --git a/clang/test/CIR/IR/side-effect.cir b/clang/test/CIR/IR/side-effect.cir index 76659f5c6ef3..1c3366ebf9af 100644 --- a/clang/test/CIR/IR/side-effect.cir +++ b/clang/test/CIR/IR/side-effect.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck %s --input-file=%t.cir +// RUN: cir-opt %s -split-input-file --verify-roundtrip | FileCheck %s !s32i = !cir.int diff --git a/clang/test/CIR/IR/stack-save-restore.cir b/clang/test/CIR/IR/stack-save-restore.cir index f6027258786d..bc199d5856c3 100644 --- a/clang/test/CIR/IR/stack-save-restore.cir +++ b/clang/test/CIR/IR/stack-save-restore.cir @@ -1,6 +1,6 @@ // Test the CIR operations can parse and print correctly (roundtrip) -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u8i = !cir.int diff --git a/clang/test/CIR/IR/struct.cir b/clang/test/CIR/IR/struct.cir index 5212bc6f1379..e874edc3844f 100644 --- a/clang/test/CIR/IR/struct.cir +++ b/clang/test/CIR/IR/struct.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u8i = !cir.int !u16i = !cir.int diff --git a/clang/test/CIR/IR/switch.cir b/clang/test/CIR/IR/switch.cir index 0bdc9c1e7e89..87d45bf1f521 100644 --- a/clang/test/CIR/IR/switch.cir +++ b/clang/test/CIR/IR/switch.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s32i = !cir.int cir.func @s0() { diff --git a/clang/test/CIR/IR/tbaa-parse.cir b/clang/test/CIR/IR/tbaa-parse.cir index dd3de33d27e2..723c31537704 100644 --- a/clang/test/CIR/IR/tbaa-parse.cir +++ b/clang/test/CIR/IR/tbaa-parse.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s -o - | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !s16i = !cir.int !s32i = !cir.int diff --git a/clang/test/CIR/IR/ternary.cir b/clang/test/CIR/IR/ternary.cir index 3827dc77726d..9b7a1a8dd48e 100644 --- a/clang/test/CIR/IR/ternary.cir +++ b/clang/test/CIR/IR/ternary.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u32i = !cir.int module { diff --git a/clang/test/CIR/IR/try.cir b/clang/test/CIR/IR/try.cir index 9104cebd19db..3e53edb29292 100644 --- a/clang/test/CIR/IR/try.cir +++ b/clang/test/CIR/IR/try.cir @@ -1,22 +1,22 @@ -// Test attempts to build bogus CIR -// RUN: cir-opt %s +// RUN: cir-opt %s -verify-roundtrip | FileCheck %s !s32i = !cir.int -module { - cir.func @div(%x : !s32i, %y : !s32i) -> !s32i { - %3 = cir.const #cir.int<0> : !s32i - cir.return %3 : !s32i - } +// CHECK: cir.func @div +cir.func @div(%x : !s32i, %y : !s32i) -> !s32i { + %3 = cir.const #cir.int<0> : !s32i + cir.return %3 : !s32i +} - cir.func @foo(%x : !s32i, %y : !s32i) -> () { +// CHECK: cir.func @foo +cir.func @foo(%x : !s32i, %y : !s32i) -> () { + cir.scope { cir.scope { - cir.scope { - %d = cir.call exception @div(%x, %y) : (!s32i, !s32i) -> !s32i - cir.yield - } + // CHECK: cir.call exception + %d = cir.call exception @div(%x, %y) : (!s32i, !s32i) -> !s32i cir.yield } - cir.return + cir.yield } + cir.return } \ No newline at end of file diff --git a/clang/test/CIR/IR/types.cir b/clang/test/CIR/IR/types.cir index b69439924a41..3ff4957b6fb2 100644 --- a/clang/test/CIR/IR/types.cir +++ b/clang/test/CIR/IR/types.cir @@ -1,4 +1,4 @@ -// RUN: cir-opt %s | cir-opt | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u32i = !cir.int diff --git a/clang/test/CIR/IR/unreachable.cir b/clang/test/CIR/IR/unreachable.cir index d057f47ee2b3..d132e434c451 100644 --- a/clang/test/CIR/IR/unreachable.cir +++ b/clang/test/CIR/IR/unreachable.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s cir.func @test() { cir.unreachable diff --git a/clang/test/CIR/IR/vtableAttr.cir b/clang/test/CIR/IR/vtableAttr.cir index db6e37da137e..ebc3a96983e1 100644 --- a/clang/test/CIR/IR/vtableAttr.cir +++ b/clang/test/CIR/IR/vtableAttr.cir @@ -1,8 +1,7 @@ -// RUN: cir-opt %s | FileCheck %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s !u8i = !cir.int -module { - // Should parse VTable attribute. - cir.global external @testVTable = #cir.vtable<{#cir.const_array<[#cir.ptr : !cir.ptr]> : !cir.array x 1>}> : !cir.record x 1>}> - // CHECK: cir.global external @testVTable = #cir.vtable<{#cir.const_array<[#cir.ptr : !cir.ptr]> : !cir.array x 1>}> : !rec_anon_struct -} + +// Should parse VTable attribute. +cir.global external @testVTable = #cir.vtable<{#cir.const_array<[#cir.ptr : !cir.ptr]> : !cir.array x 1>}> : !cir.record x 1>}> +// CHECK: cir.global external @testVTable = #cir.vtable<{#cir.const_array<[#cir.ptr : !cir.ptr]> : !cir.array x 1>}> : !rec_anon_struct diff --git a/clang/test/CIR/IR/while.cir b/clang/test/CIR/IR/while.cir index 85897af76800..fa93f1cc52d2 100644 --- a/clang/test/CIR/IR/while.cir +++ b/clang/test/CIR/IR/while.cir @@ -1,5 +1,4 @@ -// RUN: cir-opt %s -o %t.cir -// RUN: FileCheck --input-file=%t.cir %s +// RUN: cir-opt %s --verify-roundtrip | FileCheck %s cir.func @testPrintingParsing(%arg0 : !cir.bool) { cir.while {