[llvm] 4fe0fcd - [llvm-mca][JSON] Teach the PipelinePrinter how to deal with anonymous code regions (PR51008)
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 10 06:07:34 PDT 2021
Author: Andrea Di Biagio
Date: 2021-07-10T13:57:52+01:00
New Revision: 4fe0fcd1c032091f60cabc70ee72a3b0f529a875
URL: https://github.com/llvm/llvm-project/commit/4fe0fcd1c032091f60cabc70ee72a3b0f529a875
DIFF: https://github.com/llvm/llvm-project/commit/4fe0fcd1c032091f60cabc70ee72a3b0f529a875.diff
LOG: [llvm-mca][JSON] Teach the PipelinePrinter how to deal with anonymous code regions (PR51008)
This patch addresses the last remaining problems reported in PR51008.
Previous fixes for PR51008 worked under the wrong assumption that code regions
are always named (except maybe for the default region, which was automatically
named "main").
In reality, it is quite common for users to declare multiple anonymous regions.
So we cannot really use the region name as the key string of a JSON object. In
practice, code region names are completely optional.
Using "main" for the default region was also problematic because there can be
another region with that same name.
This patch fixes these issues by introducing a json::array of regions. Each
region has a "Name" field, which would default to the empty string for anonymous
regions.
Added a few more tests to verify that the JSON file format is still valid, and
that multiple anonymous regions all appear in the final output.
Added:
llvm/test/tools/llvm-mca/JSON/X86/instruction-tables-multiple-anonymous-regions.s
llvm/test/tools/llvm-mca/JSON/X86/views-multiple-anonymous-regions.s
Modified:
llvm/test/tools/llvm-mca/JSON/X86/instruction-tables-multiple-regions.s
llvm/test/tools/llvm-mca/JSON/X86/views-multiple-region.s
llvm/test/tools/llvm-mca/JSON/X86/views.s
llvm/tools/llvm-mca/PipelinePrinter.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-mca/JSON/X86/instruction-tables-multiple-anonymous-regions.s b/llvm/test/tools/llvm-mca/JSON/X86/instruction-tables-multiple-anonymous-regions.s
new file mode 100644
index 000000000000..e3e90f65a9fe
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/JSON/X86/instruction-tables-multiple-anonymous-regions.s
@@ -0,0 +1,256 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=haswell --json -instruction-tables < %s | FileCheck %s
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=haswell --json -instruction-tables -o %t.json < %s
+# RUN: cat %t.json \
+# RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+# RUN: | FileCheck %s
+
+# LLVM-MCA-BEGIN
+add %eax, %eax
+# LLVM-MCA-END
+# LLVM-MCA-BEGIN
+add %ebx, %ebx
+add %ecx, %ecx
+# LLVM-MCA-END
+# LLVM-MCA-BEGIN
+add %edx, %edx
+# LLVM-MCA-END
+
+# CHECK: {
+# CHECK-NEXT: "CodeRegions": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%eax, %eax"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 1,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%ebx, %ebx",
+# CHECK-NEXT: "addl\t%ecx, %ecx"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%edx, %edx"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: }
+# CHECK-NEXT: ],
+# CHECK-NEXT: "TargetInfo": {
+# CHECK-NEXT: "CPUName": "haswell",
+# CHECK-NEXT: "Resources": [
+# CHECK-NEXT: "HWDivider",
+# CHECK-NEXT: "HWFPDivider",
+# CHECK-NEXT: "HWPort0",
+# CHECK-NEXT: "HWPort1",
+# CHECK-NEXT: "HWPort2",
+# CHECK-NEXT: "HWPort3",
+# CHECK-NEXT: "HWPort4",
+# CHECK-NEXT: "HWPort5",
+# CHECK-NEXT: "HWPort6",
+# CHECK-NEXT: "HWPort7"
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: }
diff --git a/llvm/test/tools/llvm-mca/JSON/X86/instruction-tables-multiple-regions.s b/llvm/test/tools/llvm-mca/JSON/X86/instruction-tables-multiple-regions.s
index 758b57d0479b..4942a713f22c 100644
--- a/llvm/test/tools/llvm-mca/JSON/X86/instruction-tables-multiple-regions.s
+++ b/llvm/test/tools/llvm-mca/JSON/X86/instruction-tables-multiple-regions.s
@@ -15,6 +15,254 @@ add %edx, %edx
# LLVM-MCA-END foo
# CHECK: {
+# CHECK-NEXT: "CodeRegions": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 1,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 2,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 3,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%eax, %eax",
+# CHECK-NEXT: "addl\t%ebx, %ebx",
+# CHECK-NEXT: "addl\t%ecx, %ecx",
+# CHECK-NEXT: "addl\t%edx, %edx"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "foo",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 3,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 3,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 3,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 3,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 1,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%ebx, %ebx",
+# CHECK-NEXT: "addl\t%ecx, %ecx"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "bar",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: }
+# CHECK-NEXT: ],
# CHECK-NEXT: "TargetInfo": {
# CHECK-NEXT: "CPUName": "haswell",
# CHECK-NEXT: "Resources": [
@@ -29,249 +277,5 @@ add %edx, %edx
# CHECK-NEXT: "HWPort6",
# CHECK-NEXT: "HWPort7"
# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "bar": {
-# CHECK-NEXT: "InstructionInfoView": {
-# CHECK-NEXT: "InstructionList": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 0,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 1,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "Instructions": [
-# CHECK-NEXT: "addl\t%ebx, %ebx",
-# CHECK-NEXT: "addl\t%ecx, %ecx"
-# CHECK-NEXT: ],
-# CHECK-NEXT: "ResourcePressureView": {
-# CHECK-NEXT: "ResourcePressureInfo": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "foo": {
-# CHECK-NEXT: "InstructionInfoView": {
-# CHECK-NEXT: "InstructionList": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 0,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 1,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 2,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 3,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "Instructions": [
-# CHECK-NEXT: "addl\t%eax, %eax",
-# CHECK-NEXT: "addl\t%ebx, %ebx",
-# CHECK-NEXT: "addl\t%ecx, %ecx",
-# CHECK-NEXT: "addl\t%edx, %edx"
-# CHECK-NEXT: ],
-# CHECK-NEXT: "ResourcePressureView": {
-# CHECK-NEXT: "ResourcePressureInfo": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 3,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 3,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 3,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 3,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 0.25
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: }
diff --git a/llvm/test/tools/llvm-mca/JSON/X86/views-multiple-anonymous-regions.s b/llvm/test/tools/llvm-mca/JSON/X86/views-multiple-anonymous-regions.s
new file mode 100644
index 000000000000..fe7941bdb5e9
--- /dev/null
+++ b/llvm/test/tools/llvm-mca/JSON/X86/views-multiple-anonymous-regions.s
@@ -0,0 +1,585 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=haswell --json -all-views < %s | FileCheck %s
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=haswell --json -all-views -o %t.json < %s
+# RUN: cat %t.json \
+# RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+# RUN: | FileCheck %s
+
+# LLVM-MCA-BEGIN
+add %eax, %eax
+# LLVM-MCA-END
+# LLVM-MCA-BEGIN
+add %ebx, %ebx
+add %ecx, %ecx
+# LLVM-MCA-END
+# LLVM-MCA-BEGIN
+add %edx, %edx
+# LLVM-MCA-END
+
+# CHECK: {
+# CHECK-NEXT: "CodeRegions": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "DispatchStatistics": {
+# CHECK-NEXT: "GROUP": 0,
+# CHECK-NEXT: "LQ": 0,
+# CHECK-NEXT: "RAT": 0,
+# CHECK-NEXT: "RCU": 0,
+# CHECK-NEXT: "SCHEDQ": 21,
+# CHECK-NEXT: "SQ": 0,
+# CHECK-NEXT: "USH": 0
+# CHECK-NEXT: },
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%eax, %eax"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "SummaryView": {
+# CHECK-NEXT: "BlockRThroughput": 0.25,
+# CHECK-NEXT: "DispatchWidth": 4,
+# CHECK-NEXT: "IPC": 0.970873786407767,
+# CHECK-NEXT: "Instructions": 100,
+# CHECK-NEXT: "Iterations": 100,
+# CHECK-NEXT: "TotalCycles": 103,
+# CHECK-NEXT: "TotaluOps": 100,
+# CHECK-NEXT: "uOpsPerCycle": 0.970873786407767
+# CHECK-NEXT: },
+# CHECK-NEXT: "TimelineView": {
+# CHECK-NEXT: "TimelineInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 3,
+# CHECK-NEXT: "CycleIssued": 2,
+# CHECK-NEXT: "CycleReady": 2,
+# CHECK-NEXT: "CycleRetired": 4
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 4,
+# CHECK-NEXT: "CycleIssued": 3,
+# CHECK-NEXT: "CycleReady": 3,
+# CHECK-NEXT: "CycleRetired": 5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 5,
+# CHECK-NEXT: "CycleIssued": 4,
+# CHECK-NEXT: "CycleReady": 4,
+# CHECK-NEXT: "CycleRetired": 6
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 6,
+# CHECK-NEXT: "CycleIssued": 5,
+# CHECK-NEXT: "CycleReady": 5,
+# CHECK-NEXT: "CycleRetired": 7
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 7,
+# CHECK-NEXT: "CycleIssued": 6,
+# CHECK-NEXT: "CycleReady": 6,
+# CHECK-NEXT: "CycleRetired": 8
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 8,
+# CHECK-NEXT: "CycleIssued": 7,
+# CHECK-NEXT: "CycleReady": 7,
+# CHECK-NEXT: "CycleRetired": 9
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 9,
+# CHECK-NEXT: "CycleIssued": 8,
+# CHECK-NEXT: "CycleReady": 8,
+# CHECK-NEXT: "CycleRetired": 10
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 2,
+# CHECK-NEXT: "CycleExecuted": 10,
+# CHECK-NEXT: "CycleIssued": 9,
+# CHECK-NEXT: "CycleReady": 9,
+# CHECK-NEXT: "CycleRetired": 11
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 2,
+# CHECK-NEXT: "CycleExecuted": 11,
+# CHECK-NEXT: "CycleIssued": 10,
+# CHECK-NEXT: "CycleReady": 10,
+# CHECK-NEXT: "CycleRetired": 12
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "DispatchStatistics": {
+# CHECK-NEXT: "GROUP": 0,
+# CHECK-NEXT: "LQ": 0,
+# CHECK-NEXT: "RAT": 0,
+# CHECK-NEXT: "RCU": 0,
+# CHECK-NEXT: "SCHEDQ": 41,
+# CHECK-NEXT: "SQ": 0,
+# CHECK-NEXT: "USH": 0
+# CHECK-NEXT: },
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 1,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%ebx, %ebx",
+# CHECK-NEXT: "addl\t%ecx, %ecx"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "SummaryView": {
+# CHECK-NEXT: "BlockRThroughput": 0.5,
+# CHECK-NEXT: "DispatchWidth": 4,
+# CHECK-NEXT: "IPC": 1.941747572815534,
+# CHECK-NEXT: "Instructions": 200,
+# CHECK-NEXT: "Iterations": 100,
+# CHECK-NEXT: "TotalCycles": 103,
+# CHECK-NEXT: "TotaluOps": 200,
+# CHECK-NEXT: "uOpsPerCycle": 1.941747572815534
+# CHECK-NEXT: },
+# CHECK-NEXT: "TimelineView": {
+# CHECK-NEXT: "TimelineInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 3,
+# CHECK-NEXT: "CycleIssued": 2,
+# CHECK-NEXT: "CycleReady": 2,
+# CHECK-NEXT: "CycleRetired": 4
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 3,
+# CHECK-NEXT: "CycleIssued": 2,
+# CHECK-NEXT: "CycleReady": 2,
+# CHECK-NEXT: "CycleRetired": 4
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 4,
+# CHECK-NEXT: "CycleIssued": 3,
+# CHECK-NEXT: "CycleReady": 3,
+# CHECK-NEXT: "CycleRetired": 5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 4,
+# CHECK-NEXT: "CycleIssued": 3,
+# CHECK-NEXT: "CycleReady": 3,
+# CHECK-NEXT: "CycleRetired": 5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 5,
+# CHECK-NEXT: "CycleIssued": 4,
+# CHECK-NEXT: "CycleReady": 4,
+# CHECK-NEXT: "CycleRetired": 6
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 5,
+# CHECK-NEXT: "CycleIssued": 4,
+# CHECK-NEXT: "CycleReady": 4,
+# CHECK-NEXT: "CycleRetired": 6
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 2,
+# CHECK-NEXT: "CycleExecuted": 6,
+# CHECK-NEXT: "CycleIssued": 5,
+# CHECK-NEXT: "CycleReady": 5,
+# CHECK-NEXT: "CycleRetired": 7
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 2,
+# CHECK-NEXT: "CycleExecuted": 6,
+# CHECK-NEXT: "CycleIssued": 5,
+# CHECK-NEXT: "CycleReady": 5,
+# CHECK-NEXT: "CycleRetired": 7
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 2,
+# CHECK-NEXT: "CycleExecuted": 7,
+# CHECK-NEXT: "CycleIssued": 6,
+# CHECK-NEXT: "CycleReady": 6,
+# CHECK-NEXT: "CycleRetired": 8
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 2,
+# CHECK-NEXT: "CycleExecuted": 7,
+# CHECK-NEXT: "CycleIssued": 6,
+# CHECK-NEXT: "CycleReady": 6,
+# CHECK-NEXT: "CycleRetired": 8
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 3,
+# CHECK-NEXT: "CycleExecuted": 8,
+# CHECK-NEXT: "CycleIssued": 7,
+# CHECK-NEXT: "CycleReady": 7,
+# CHECK-NEXT: "CycleRetired": 9
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 3,
+# CHECK-NEXT: "CycleExecuted": 8,
+# CHECK-NEXT: "CycleIssued": 7,
+# CHECK-NEXT: "CycleReady": 7,
+# CHECK-NEXT: "CycleRetired": 9
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 3,
+# CHECK-NEXT: "CycleExecuted": 9,
+# CHECK-NEXT: "CycleIssued": 8,
+# CHECK-NEXT: "CycleReady": 8,
+# CHECK-NEXT: "CycleRetired": 10
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 3,
+# CHECK-NEXT: "CycleExecuted": 9,
+# CHECK-NEXT: "CycleIssued": 8,
+# CHECK-NEXT: "CycleReady": 8,
+# CHECK-NEXT: "CycleRetired": 10
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 4,
+# CHECK-NEXT: "CycleExecuted": 10,
+# CHECK-NEXT: "CycleIssued": 9,
+# CHECK-NEXT: "CycleReady": 9,
+# CHECK-NEXT: "CycleRetired": 11
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 4,
+# CHECK-NEXT: "CycleExecuted": 10,
+# CHECK-NEXT: "CycleIssued": 9,
+# CHECK-NEXT: "CycleReady": 9,
+# CHECK-NEXT: "CycleRetired": 11
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 4,
+# CHECK-NEXT: "CycleExecuted": 11,
+# CHECK-NEXT: "CycleIssued": 10,
+# CHECK-NEXT: "CycleReady": 10,
+# CHECK-NEXT: "CycleRetired": 12
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 4,
+# CHECK-NEXT: "CycleExecuted": 11,
+# CHECK-NEXT: "CycleIssued": 10,
+# CHECK-NEXT: "CycleReady": 10,
+# CHECK-NEXT: "CycleRetired": 12
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "DispatchStatistics": {
+# CHECK-NEXT: "GROUP": 0,
+# CHECK-NEXT: "LQ": 0,
+# CHECK-NEXT: "RAT": 0,
+# CHECK-NEXT: "RCU": 0,
+# CHECK-NEXT: "SCHEDQ": 21,
+# CHECK-NEXT: "SQ": 0,
+# CHECK-NEXT: "USH": 0
+# CHECK-NEXT: },
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%edx, %edx"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.25
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "SummaryView": {
+# CHECK-NEXT: "BlockRThroughput": 0.25,
+# CHECK-NEXT: "DispatchWidth": 4,
+# CHECK-NEXT: "IPC": 0.970873786407767,
+# CHECK-NEXT: "Instructions": 100,
+# CHECK-NEXT: "Iterations": 100,
+# CHECK-NEXT: "TotalCycles": 103,
+# CHECK-NEXT: "TotaluOps": 100,
+# CHECK-NEXT: "uOpsPerCycle": 0.970873786407767
+# CHECK-NEXT: },
+# CHECK-NEXT: "TimelineView": {
+# CHECK-NEXT: "TimelineInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 3,
+# CHECK-NEXT: "CycleIssued": 2,
+# CHECK-NEXT: "CycleReady": 2,
+# CHECK-NEXT: "CycleRetired": 4
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 4,
+# CHECK-NEXT: "CycleIssued": 3,
+# CHECK-NEXT: "CycleReady": 3,
+# CHECK-NEXT: "CycleRetired": 5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 5,
+# CHECK-NEXT: "CycleIssued": 4,
+# CHECK-NEXT: "CycleReady": 4,
+# CHECK-NEXT: "CycleRetired": 6
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 6,
+# CHECK-NEXT: "CycleIssued": 5,
+# CHECK-NEXT: "CycleReady": 5,
+# CHECK-NEXT: "CycleRetired": 7
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 7,
+# CHECK-NEXT: "CycleIssued": 6,
+# CHECK-NEXT: "CycleReady": 6,
+# CHECK-NEXT: "CycleRetired": 8
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 8,
+# CHECK-NEXT: "CycleIssued": 7,
+# CHECK-NEXT: "CycleReady": 7,
+# CHECK-NEXT: "CycleRetired": 9
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 1,
+# CHECK-NEXT: "CycleExecuted": 9,
+# CHECK-NEXT: "CycleIssued": 8,
+# CHECK-NEXT: "CycleReady": 8,
+# CHECK-NEXT: "CycleRetired": 10
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 2,
+# CHECK-NEXT: "CycleExecuted": 10,
+# CHECK-NEXT: "CycleIssued": 9,
+# CHECK-NEXT: "CycleReady": 9,
+# CHECK-NEXT: "CycleRetired": 11
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 2,
+# CHECK-NEXT: "CycleExecuted": 11,
+# CHECK-NEXT: "CycleIssued": 10,
+# CHECK-NEXT: "CycleReady": 10,
+# CHECK-NEXT: "CycleRetired": 12
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: }
+# CHECK-NEXT: ],
+# CHECK-NEXT: "TargetInfo": {
+# CHECK-NEXT: "CPUName": "haswell",
+# CHECK-NEXT: "Resources": [
+# CHECK-NEXT: "HWDivider",
+# CHECK-NEXT: "HWFPDivider",
+# CHECK-NEXT: "HWPort0",
+# CHECK-NEXT: "HWPort1",
+# CHECK-NEXT: "HWPort2",
+# CHECK-NEXT: "HWPort3",
+# CHECK-NEXT: "HWPort4",
+# CHECK-NEXT: "HWPort5",
+# CHECK-NEXT: "HWPort6",
+# CHECK-NEXT: "HWPort7"
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: }
diff --git a/llvm/test/tools/llvm-mca/JSON/X86/views-multiple-region.s b/llvm/test/tools/llvm-mca/JSON/X86/views-multiple-region.s
index 55768b53a2b9..95424cc6d30d 100644
--- a/llvm/test/tools/llvm-mca/JSON/X86/views-multiple-region.s
+++ b/llvm/test/tools/llvm-mca/JSON/X86/views-multiple-region.s
@@ -18,6 +18,262 @@ add %edx, %edx
# LLVM-MCA-END foo
# CHECK: {
+# CHECK-NEXT: "CodeRegions": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "DispatchStatistics": {
+# CHECK-NEXT: "GROUP": 0,
+# CHECK-NEXT: "LQ": 0,
+# CHECK-NEXT: "RAT": 0,
+# CHECK-NEXT: "RCU": 0,
+# CHECK-NEXT: "SCHEDQ": 0,
+# CHECK-NEXT: "SQ": 0,
+# CHECK-NEXT: "USH": 0
+# CHECK-NEXT: },
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 1,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 2,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 3,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%eax, %eax",
+# CHECK-NEXT: "addl\t%ebx, %ebx",
+# CHECK-NEXT: "addl\t%ecx, %ecx",
+# CHECK-NEXT: "addl\t%edx, %edx"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "foo",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 3,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "SummaryView": {
+# CHECK-NEXT: "BlockRThroughput": 1,
+# CHECK-NEXT: "DispatchWidth": 4,
+# CHECK-NEXT: "IPC": 3.883495145631068,
+# CHECK-NEXT: "Instructions": 400,
+# CHECK-NEXT: "Iterations": 100,
+# CHECK-NEXT: "TotalCycles": 103,
+# CHECK-NEXT: "TotaluOps": 400,
+# CHECK-NEXT: "uOpsPerCycle": 3.883495145631068
+# CHECK-NEXT: },
+# CHECK-NEXT: "TimelineView": {
+# CHECK-NEXT: "TimelineInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "DispatchStatistics": {
+# CHECK-NEXT: "GROUP": 0,
+# CHECK-NEXT: "LQ": 0,
+# CHECK-NEXT: "RAT": 0,
+# CHECK-NEXT: "RCU": 0,
+# CHECK-NEXT: "SCHEDQ": 41,
+# CHECK-NEXT: "SQ": 0,
+# CHECK-NEXT: "USH": 0
+# CHECK-NEXT: },
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 1,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%ebx, %ebx",
+# CHECK-NEXT: "addl\t%ecx, %ecx"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "bar",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 0.5
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "SummaryView": {
+# CHECK-NEXT: "BlockRThroughput": 0.5,
+# CHECK-NEXT: "DispatchWidth": 4,
+# CHECK-NEXT: "IPC": 1.941747572815534,
+# CHECK-NEXT: "Instructions": 200,
+# CHECK-NEXT: "Iterations": 100,
+# CHECK-NEXT: "TotalCycles": 103,
+# CHECK-NEXT: "TotaluOps": 200,
+# CHECK-NEXT: "uOpsPerCycle": 1.941747572815534
+# CHECK-NEXT: },
+# CHECK-NEXT: "TimelineView": {
+# CHECK-NEXT: "TimelineInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: }
+# CHECK-NEXT: ],
# CHECK-NEXT: "TargetInfo": {
# CHECK-NEXT: "CPUName": "haswell",
# CHECK-NEXT: "Resources": [
@@ -32,257 +288,5 @@ add %edx, %edx
# CHECK-NEXT: "HWPort6",
# CHECK-NEXT: "HWPort7"
# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "bar": {
-# CHECK-NEXT: "DispatchStatistics": {
-# CHECK-NEXT: "GROUP": 0,
-# CHECK-NEXT: "LQ": 0,
-# CHECK-NEXT: "RAT": 0,
-# CHECK-NEXT: "RCU": 0,
-# CHECK-NEXT: "SCHEDQ": 41,
-# CHECK-NEXT: "SQ": 0,
-# CHECK-NEXT: "USH": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "InstructionInfoView": {
-# CHECK-NEXT: "InstructionList": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 0,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 1,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "Instructions": [
-# CHECK-NEXT: "addl\t%ebx, %ebx",
-# CHECK-NEXT: "addl\t%ecx, %ecx"
-# CHECK-NEXT: ],
-# CHECK-NEXT: "ResourcePressureView": {
-# CHECK-NEXT: "ResourcePressureInfo": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 0.5
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "SummaryView": {
-# CHECK-NEXT: "BlockRThroughput": 0.5,
-# CHECK-NEXT: "DispatchWidth": 4,
-# CHECK-NEXT: "IPC": 1.941747572815534,
-# CHECK-NEXT: "Instructions": 200,
-# CHECK-NEXT: "Iterations": 100,
-# CHECK-NEXT: "TotalCycles": 103,
-# CHECK-NEXT: "TotaluOps": 200,
-# CHECK-NEXT: "uOpsPerCycle": 1.941747572815534
-# CHECK-NEXT: },
-# CHECK-NEXT: "TimelineView": {
-# CHECK-NEXT: "TimelineInfo": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "CycleDispatched": 0,
-# CHECK-NEXT: "CycleExecuted": 2,
-# CHECK-NEXT: "CycleIssued": 1,
-# CHECK-NEXT: "CycleReady": 0,
-# CHECK-NEXT: "CycleRetired": 3
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "CycleDispatched": 0,
-# CHECK-NEXT: "CycleExecuted": 2,
-# CHECK-NEXT: "CycleIssued": 1,
-# CHECK-NEXT: "CycleReady": 0,
-# CHECK-NEXT: "CycleRetired": 3
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "foo": {
-# CHECK-NEXT: "DispatchStatistics": {
-# CHECK-NEXT: "GROUP": 0,
-# CHECK-NEXT: "LQ": 0,
-# CHECK-NEXT: "RAT": 0,
-# CHECK-NEXT: "RCU": 0,
-# CHECK-NEXT: "SCHEDQ": 0,
-# CHECK-NEXT: "SQ": 0,
-# CHECK-NEXT: "USH": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "InstructionInfoView": {
-# CHECK-NEXT: "InstructionList": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 0,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 1,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 2,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 3,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "Instructions": [
-# CHECK-NEXT: "addl\t%eax, %eax",
-# CHECK-NEXT: "addl\t%ebx, %ebx",
-# CHECK-NEXT: "addl\t%ecx, %ecx",
-# CHECK-NEXT: "addl\t%edx, %edx"
-# CHECK-NEXT: ],
-# CHECK-NEXT: "ResourcePressureView": {
-# CHECK-NEXT: "ResourcePressureInfo": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 3,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "SummaryView": {
-# CHECK-NEXT: "BlockRThroughput": 1,
-# CHECK-NEXT: "DispatchWidth": 4,
-# CHECK-NEXT: "IPC": 3.883495145631068,
-# CHECK-NEXT: "Instructions": 400,
-# CHECK-NEXT: "Iterations": 100,
-# CHECK-NEXT: "TotalCycles": 103,
-# CHECK-NEXT: "TotaluOps": 400,
-# CHECK-NEXT: "uOpsPerCycle": 3.883495145631068
-# CHECK-NEXT: },
-# CHECK-NEXT: "TimelineView": {
-# CHECK-NEXT: "TimelineInfo": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "CycleDispatched": 0,
-# CHECK-NEXT: "CycleExecuted": 2,
-# CHECK-NEXT: "CycleIssued": 1,
-# CHECK-NEXT: "CycleReady": 0,
-# CHECK-NEXT: "CycleRetired": 3
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "CycleDispatched": 0,
-# CHECK-NEXT: "CycleExecuted": 2,
-# CHECK-NEXT: "CycleIssued": 1,
-# CHECK-NEXT: "CycleReady": 0,
-# CHECK-NEXT: "CycleRetired": 3
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "CycleDispatched": 0,
-# CHECK-NEXT: "CycleExecuted": 2,
-# CHECK-NEXT: "CycleIssued": 1,
-# CHECK-NEXT: "CycleReady": 0,
-# CHECK-NEXT: "CycleRetired": 3
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "CycleDispatched": 0,
-# CHECK-NEXT: "CycleExecuted": 2,
-# CHECK-NEXT: "CycleIssued": 1,
-# CHECK-NEXT: "CycleReady": 0,
-# CHECK-NEXT: "CycleRetired": 3
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: }
diff --git a/llvm/test/tools/llvm-mca/JSON/X86/views.s b/llvm/test/tools/llvm-mca/JSON/X86/views.s
index c718a0e86ffd..50ec80e63f2a 100644
--- a/llvm/test/tools/llvm-mca/JSON/X86/views.s
+++ b/llvm/test/tools/llvm-mca/JSON/X86/views.s
@@ -14,6 +14,152 @@ add %ecx, %ecx
add %edx, %edx
# CHECK: {
+# CHECK-NEXT: "CodeRegions": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "DispatchStatistics": {
+# CHECK-NEXT: "GROUP": 0,
+# CHECK-NEXT: "LQ": 0,
+# CHECK-NEXT: "RAT": 0,
+# CHECK-NEXT: "RCU": 0,
+# CHECK-NEXT: "SCHEDQ": 0,
+# CHECK-NEXT: "SQ": 0,
+# CHECK-NEXT: "USH": 0
+# CHECK-NEXT: },
+# CHECK-NEXT: "InstructionInfoView": {
+# CHECK-NEXT: "InstructionList": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 0,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 1,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 2,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "Instruction": 3,
+# CHECK-NEXT: "Latency": 1,
+# CHECK-NEXT: "NumMicroOpcodes": 1,
+# CHECK-NEXT: "RThroughput": 0.25,
+# CHECK-NEXT: "hasUnmodeledSideEffects": false,
+# CHECK-NEXT: "mayLoad": false,
+# CHECK-NEXT: "mayStore": false
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "Instructions": [
+# CHECK-NEXT: "addl\t%eax, %eax",
+# CHECK-NEXT: "addl\t%ebx, %ebx",
+# CHECK-NEXT: "addl\t%ecx, %ecx",
+# CHECK-NEXT: "addl\t%edx, %edx"
+# CHECK-NEXT: ],
+# CHECK-NEXT: "Name": "",
+# CHECK-NEXT: "ResourcePressureView": {
+# CHECK-NEXT: "ResourcePressureInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 0,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 1,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 2,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 3,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 2,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 3,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 7,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "InstructionIndex": 4,
+# CHECK-NEXT: "ResourceIndex": 8,
+# CHECK-NEXT: "ResourceUsage": 1
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: },
+# CHECK-NEXT: "SummaryView": {
+# CHECK-NEXT: "BlockRThroughput": 1,
+# CHECK-NEXT: "DispatchWidth": 4,
+# CHECK-NEXT: "IPC": 3.883495145631068,
+# CHECK-NEXT: "Instructions": 400,
+# CHECK-NEXT: "Iterations": 100,
+# CHECK-NEXT: "TotalCycles": 103,
+# CHECK-NEXT: "TotaluOps": 400,
+# CHECK-NEXT: "uOpsPerCycle": 3.883495145631068
+# CHECK-NEXT: },
+# CHECK-NEXT: "TimelineView": {
+# CHECK-NEXT: "TimelineInfo": [
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: },
+# CHECK-NEXT: {
+# CHECK-NEXT: "CycleDispatched": 0,
+# CHECK-NEXT: "CycleExecuted": 2,
+# CHECK-NEXT: "CycleIssued": 1,
+# CHECK-NEXT: "CycleReady": 0,
+# CHECK-NEXT: "CycleRetired": 3
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+# CHECK-NEXT: }
+# CHECK-NEXT: }
+# CHECK-NEXT: ],
# CHECK-NEXT: "TargetInfo": {
# CHECK-NEXT: "CPUName": "haswell",
# CHECK-NEXT: "Resources": [
@@ -28,148 +174,5 @@ add %edx, %edx
# CHECK-NEXT: "HWPort6",
# CHECK-NEXT: "HWPort7"
# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "main": {
-# CHECK-NEXT: "DispatchStatistics": {
-# CHECK-NEXT: "GROUP": 0,
-# CHECK-NEXT: "LQ": 0,
-# CHECK-NEXT: "RAT": 0,
-# CHECK-NEXT: "RCU": 0,
-# CHECK-NEXT: "SCHEDQ": 0,
-# CHECK-NEXT: "SQ": 0,
-# CHECK-NEXT: "USH": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "InstructionInfoView": {
-# CHECK-NEXT: "InstructionList": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 0,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 1,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 2,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "Instruction": 3,
-# CHECK-NEXT: "Latency": 1,
-# CHECK-NEXT: "NumMicroOpcodes": 1,
-# CHECK-NEXT: "RThroughput": 0.25,
-# CHECK-NEXT: "hasUnmodeledSideEffects": false,
-# CHECK-NEXT: "mayLoad": false,
-# CHECK-NEXT: "mayStore": false
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "Instructions": [
-# CHECK-NEXT: "addl\t%eax, %eax",
-# CHECK-NEXT: "addl\t%ebx, %ebx",
-# CHECK-NEXT: "addl\t%ecx, %ecx",
-# CHECK-NEXT: "addl\t%edx, %edx"
-# CHECK-NEXT: ],
-# CHECK-NEXT: "ResourcePressureView": {
-# CHECK-NEXT: "ResourcePressureInfo": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 0,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 1,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 2,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 3,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 2,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 3,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 7,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "InstructionIndex": 4,
-# CHECK-NEXT: "ResourceIndex": 8,
-# CHECK-NEXT: "ResourceUsage": 1
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "SummaryView": {
-# CHECK-NEXT: "BlockRThroughput": 1,
-# CHECK-NEXT: "DispatchWidth": 4,
-# CHECK-NEXT: "IPC": 3.883495145631068,
-# CHECK-NEXT: "Instructions": 400,
-# CHECK-NEXT: "Iterations": 100,
-# CHECK-NEXT: "TotalCycles": 103,
-# CHECK-NEXT: "TotaluOps": 400,
-# CHECK-NEXT: "uOpsPerCycle": 3.883495145631068
-# CHECK-NEXT: },
-# CHECK-NEXT: "TimelineView": {
-# CHECK-NEXT: "TimelineInfo": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "CycleDispatched": 0,
-# CHECK-NEXT: "CycleExecuted": 2,
-# CHECK-NEXT: "CycleIssued": 1,
-# CHECK-NEXT: "CycleReady": 0,
-# CHECK-NEXT: "CycleRetired": 3
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "CycleDispatched": 0,
-# CHECK-NEXT: "CycleExecuted": 2,
-# CHECK-NEXT: "CycleIssued": 1,
-# CHECK-NEXT: "CycleReady": 0,
-# CHECK-NEXT: "CycleRetired": 3
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "CycleDispatched": 0,
-# CHECK-NEXT: "CycleExecuted": 2,
-# CHECK-NEXT: "CycleIssued": 1,
-# CHECK-NEXT: "CycleReady": 0,
-# CHECK-NEXT: "CycleRetired": 3
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "CycleDispatched": 0,
-# CHECK-NEXT: "CycleExecuted": 2,
-# CHECK-NEXT: "CycleIssued": 1,
-# CHECK-NEXT: "CycleReady": 0,
-# CHECK-NEXT: "CycleRetired": 3
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: }
diff --git a/llvm/tools/llvm-mca/PipelinePrinter.cpp b/llvm/tools/llvm-mca/PipelinePrinter.cpp
index def9f350a581..8e84abc4dfe5 100644
--- a/llvm/tools/llvm-mca/PipelinePrinter.cpp
+++ b/llvm/tools/llvm-mca/PipelinePrinter.cpp
@@ -33,6 +33,11 @@ void PipelinePrinter::printRegionHeader(llvm::raw_ostream &OS) const {
json::Object PipelinePrinter::getJSONReportRegion() const {
json::Object JO;
+ StringRef RegionName = "";
+ if (!Region.getDescription().empty())
+ RegionName = Region.getDescription();
+
+ JO.try_emplace("Name", RegionName);
for (const auto &V : Views)
if (V->isSerializable())
JO.try_emplace(V->getNameAsString().str(), V->toJSON());
@@ -69,13 +74,14 @@ void PipelinePrinter::printReport(json::Object &JO) const {
if (!RegionIdx)
JO.try_emplace("TargetInfo", getJSONTargetInfo());
- StringRef RegionName;
- if (Region.getDescription().empty())
- RegionName = "main";
- else
- RegionName = Region.getDescription();
+ if (!RegionIdx) {
+ // Construct an array of regions.
+ JO.try_emplace("CodeRegions", json::Array());
+ }
- JO.try_emplace(RegionName, getJSONReportRegion());
+ json::Array *Regions = JO.getArray("CodeRegions");
+ assert(Regions && "This array must exist!");
+ Regions->push_back(getJSONReportRegion());
}
void PipelinePrinter::printReport(llvm::raw_ostream &OS) const {
More information about the llvm-commits
mailing list