[tint][disassembler] Trim 'note' source to block start

Instead of the whole block content.

Change-Id: Icac749ce0309547b59b7bc9242b9ae76cd87fed6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/136760
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/ir/disassembler.cc b/src/tint/ir/disassembler.cc
index e139d99..e12b08d 100644
--- a/src/tint/ir/disassembler.cc
+++ b/src/tint/ir/disassembler.cc
@@ -137,8 +137,10 @@
 }
 
 void Disassembler::WalkInternal(Block* blk) {
+    Indent();
+
     SourceMarker sm(this);
-    Indent() << "%b" << IdOf(blk) << " = block";
+    out_ << "%b" << IdOf(blk) << " = block";
     if (auto* merge = blk->As<MultiInBlock>()) {
         if (!merge->Params().IsEmpty()) {
             out_ << " (";
@@ -146,6 +148,7 @@
             out_ << ")";
         }
     }
+    sm.Store(blk);
 
     out_ << " {";
     EmitLine();
@@ -154,7 +157,6 @@
         EmitBlockInstructions(blk);
     }
     Indent() << "}";
-    sm.Store(blk);
 
     EmitLine();
 }
diff --git a/src/tint/ir/validate_test.cc b/src/tint/ir/validate_test.cc
index c05af9c..45ddffa 100644
--- a/src/tint/ir/validate_test.cc
+++ b/src/tint/ir/validate_test.cc
@@ -52,21 +52,7 @@
 
 :2:1 note: In block
 %b1 = block {
-^^^^^^^^^^^^^
-  loop [b: %b2]
-^^^^^^^^^^^^^^^
-    # Body block
-^^^^^^^^^^^^^^^^
-    %b2 = block {
-^^^^^^^^^^^^^^^^^
-      continue %b3
-^^^^^^^^^^^^^^^^^^
-    }
-^^^^^
-
-
-}
-^
+^^^^^^^^^^^
 
 note: # Disassembly
 # Root block
@@ -98,11 +84,9 @@
 
     auto res = ir::Validate(mod);
     ASSERT_FALSE(res);
-    EXPECT_EQ(res.Failure().str(), R"(:2:1 error: block: does not end in a branch
+    EXPECT_EQ(res.Failure().str(), R"(:2:3 error: block: does not end in a branch
   %b1 = block {
-^^^^^^^^^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 %my_func = func():void -> %b1 {
@@ -157,15 +141,9 @@
     %3:f32 = access %2, -1i
                         ^^^
 
-:2:1 note: In block
+:2:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    %3:f32 = access %2, -1i
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 %my_func = func(%2:vec3<f32>):void -> %b1 {
@@ -193,15 +171,9 @@
     %3:f32 = access %2, 1u, 3u
                             ^^
 
-:2:1 note: In block
+:2:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    %3:f32 = access %2, 1u, 3u
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 :3:29 note: acceptable range: [0..1]
     %3:f32 = access %2, 1u, 3u
@@ -236,15 +208,9 @@
     %3:ptr<private, f32, read_write> = access %2, 1u, 3u
                                                       ^^
 
-:2:1 note: In block
+:2:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    %3:ptr<private, f32, read_write> = access %2, 1u, 3u
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 :3:55 note: acceptable range: [0..1]
     %3:ptr<private, f32, read_write> = access %2, 1u, 3u
@@ -275,15 +241,9 @@
     %3:f32 = access %2, 1u
                         ^^
 
-:2:1 note: In block
+:2:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    %3:f32 = access %2, 1u
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 %my_func = func(%2:f32):void -> %b1 {
@@ -313,15 +273,9 @@
     %3:ptr<private, f32, read_write> = access %2, 1u
                                                   ^^
 
-:2:1 note: In block
+:2:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    %3:ptr<private, f32, read_write> = access %2, 1u
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 %my_func = func(%2:ptr<private, f32, read_write>):void -> %b1 {
@@ -358,15 +312,9 @@
     %4:i32 = access %2, %3
                         ^^
 
-:7:1 note: In block
+:7:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    %4:i32 = access %2, %3
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 tint_symbol_2 = struct @align(4) {
@@ -409,15 +357,9 @@
     %4:i32 = access %2, %3
                         ^^
 
-:7:1 note: In block
+:7:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    %4:i32 = access %2, %3
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 tint_symbol_2 = struct @align(4) {
@@ -451,15 +393,9 @@
     %3:i32 = access %2, 1u, 1u
              ^^^^^^
 
-:2:1 note: In block
+:2:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    %3:i32 = access %2, 1u, 1u
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 %my_func = func(%2:mat3x2<f32>):void -> %b1 {
@@ -491,15 +427,9 @@
     %3:ptr<private, i32, read_write> = access %2, 1u, 1u
                                        ^^^^^^
 
-:2:1 note: In block
+:2:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    %3:ptr<private, i32, read_write> = access %2, 1u, 1u
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 %my_func = func(%2:ptr<private, mat3x2<f32>, read_write>):void -> %b1 {
@@ -530,15 +460,9 @@
     %3:f32 = access %2, 1u, 1u
              ^^^^^^
 
-:2:1 note: In block
+:2:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    %3:f32 = access %2, 1u, 1u
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 %my_func = func(%2:ptr<private, mat3x2<f32>, read_write>):void -> %b1 {
@@ -561,15 +485,9 @@
     ret
     ^^^
 
-:2:1 note: In block
+:2:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    ret
-^^^^^^^
-    ret
-^^^^^^^
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 %my_func = func():void -> %b1 {
@@ -597,33 +515,9 @@
     if 1i [t: %b2, f: %b3]
        ^^
 
-:2:1 note: In block
+:2:3 note: In block
   %b1 = block {
-^^^^^^^^^^^^^^^
-    if 1i [t: %b2, f: %b3]
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-      # True block
-^^^^^^^^^^^^^^^^^^
-      %b2 = block {
-^^^^^^^^^^^^^^^^^^^
-        ret
-^^^^^^^^^^^
-      }
-^^^^^^^
-
-
-      # False block
-^^^^^^^^^^^^^^^^^^^
-      %b3 = block {
-^^^^^^^^^^^^^^^^^^^
-        ret
-^^^^^^^^^^^
-      }
-^^^^^^^
-
-
-  }
-^^^
+  ^^^^^^^^^^^
 
 note: # Disassembly
 %my_func = func():void -> %b1 {