This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Use CHECK-NEXT for irreducible-cfg.mir
ClosedPublic

Authored by aheejin on May 12 2022, 8:09 PM.

Diff Detail

Event Timeline

aheejin created this revision.May 12 2022, 8:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2022, 8:09 PM
Herald added subscribers: pmatos, asb, wingo and 4 others. · View Herald Transcript
aheejin requested review of this revision.May 12 2022, 8:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2022, 8:09 PM
asb added a comment.EditedMay 13 2022, 12:34 AM

This change looks fine to me, but have you considered just moving this test over to using update_mir_test_checks.py? It's ever so slightly more verbose, but in my experience reviewing changes that change test output are so much easier as you can just see the git diff of old vs new.

Doing so would generate this CHECK block:

+  ; CHECK-LABEL: name: test0
+  ; CHECK: bb.0.pred0:
+  ; CHECK-NEXT:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[CONST_I32_:%[0-9]+]]:i32 = CONST_I32 100, implicit-def $arguments
+  ; CHECK-NEXT:   BR_IF %bb.2, [[CONST_I32_]], implicit-def $arguments
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.1.pred1:
+  ; CHECK-NEXT:   successors: %bb.2(0x40000000), %bb.7(0x40000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   BR_IF %bb.7, [[CONST_I32_]], implicit-def $arguments
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.2:
+  ; CHECK-NEXT:   successors: %bb.6(0x80000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[CONST_I32_1:%[0-9]+]]:i32 = CONST_I32 0, implicit-def $arguments
+  ; CHECK-NEXT:   BR %bb.6, implicit-def $arguments
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.3.entry0:
+  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   BR %bb.4, implicit-def $arguments
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.4:
+  ; CHECK-NEXT:   successors: %bb.6(0x80000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[CONST_I32_2:%[0-9]+]]:i32 = CONST_I32 1, implicit-def $arguments
+  ; CHECK-NEXT:   BR %bb.6, implicit-def $arguments
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.5.entry1:
+  ; CHECK-NEXT:   successors: %bb.8(0x80000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   BR %bb.8, implicit-def $arguments
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.6:
+  ; CHECK-NEXT:   successors: %bb.3(0x40000000), %bb.5(0x40000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   BR_TABLE_I32 [[CONST_I32_2]], %bb.3, %bb.5, %bb.5, implicit-def $arguments
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.7:
+  ; CHECK-NEXT:   successors: %bb.6(0x80000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[CONST_I32_2:%[0-9]+]]:i32 = CONST_I32 1, implicit-def $arguments
+  ; CHECK-NEXT:   BR %bb.6, implicit-def $arguments
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.8:
+  ; CHECK-NEXT:   successors: %bb.6(0x80000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[CONST_I32_2:%[0-9]+]]:i32 = CONST_I32 0, implicit-def $arguments
+  ; CHECK-NEXT:   BR %bb.6, implicit-def $arguments

The script doesn't generate CHECK lines next to each BB but rather generates the whole function together, making it harder to see changes in each BB for me. Also there are comments for CHECK lines, which will be lost if we use the script. So I'm not sure using it will improve readability in this case.

dschuff accepted this revision.May 13 2022, 10:59 AM

This looks good. Keep the interleaving if you find it more readable.
But thanks for the pointer @asb, I knew about the LLVM IR version of that tool but didn't know there was a MIR one.

This revision is now accepted and ready to land.May 13 2022, 10:59 AM
asb added a comment.May 16 2022, 8:30 AM

The script doesn't generate CHECK lines next to each BB but rather generates the whole function together, making it harder to see changes in each BB for me. Also there are comments for CHECK lines, which will be lost if we use the script. So I'm not sure using it will improve readability in this case.

No problem with leaving it as-is - just thought I'd raise the suggestion.

This revision was landed with ongoing or failed builds.May 19 2022, 11:12 AM
This revision was automatically updated to reflect the committed changes.