{
  "status": "verified",
  "recognition_target": "x86_64-unknown-linux-gnu",
  "native_execution_target": "arm64-apple-darwin27.0.0",
  "tool_versions": {
    "opt": "LLVM (http://llvm.org/):\n  LLVM version 24.0.0git\n  Optimized build with assertions.\n  Default target: x86_64-unknown-linux-gnu\n  Host CPU: apple-m1",
    "mlir-opt": "LLVM (http://llvm.org/):\n  LLVM version 24.0.0git\n  Optimized build with assertions.",
    "mlir-translate": "LLVM (http://llvm.org/):\n  LLVM version 24.0.0git\n  Optimized build with assertions.",
    "llvm-as": "LLVM (http://llvm.org/):\n  LLVM version 24.0.0git\n  Optimized build with assertions."
  },
  "base_pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
  "prepared_mlir_llvm_pipeline": "function(instcombine,loop-simplify,lcssa,loop(loop-rotate,loop-idiom))",
  "cleanup_pipeline": "function(loop-simplify,lcssa,loop(loop-idiom),loop(loop-deletion),simplifycfg)",
  "examples": [
    {
      "id": "byte-fill",
      "input": "byte-fill.before.ll",
      "output": "byte-fill.after.ll",
      "pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
      "target_features": "generic/default",
      "actual_result": {
        "ordinary_memset": true,
        "memcpy": false,
        "memmove": false,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 0,
        "volatile_store_instructions": 0
      },
      "title": "연속된 바이트를 같은 값으로 채우기",
      "familiar": "for (uint64_t i = 0; i < n; ++i) dst[i] = value;",
      "meaning": "각 바이트에 같은 i8 값을 씁니다. 이번 입력에서는 llvm.memset가 생성되고 원래 store가 사라집니다.",
      "conditions": [
        "dst의 n바이트가 쓸 수 있는 범위입니다.",
        "접근은 연속이고 일반 store입니다. value는 이 루프 안에서 바뀌지 않습니다.",
        "n=0이면 원래도 쓰지 않습니다. 실제 출력도 0회 경로를 지킵니다."
      ],
      "warning": "memset는 지정한 한 바이트 값을 반복합니다. 임의의 큰 정수를 원소마다 넣는 함수가 아닙니다.",
      "generated": "@llvm.memset.",
      "cleaned": "byte-fill.cleaned.ll",
      "excerpts": {
        "signature": {
          "file": "byte-fill.before.ll",
          "line": 4,
          "code": "define void @byte_fill(ptr %dst, i64 %n, i8 %value) {"
        },
        "empty_guard": {
          "file": "byte-fill.before.ll",
          "line": 6,
          "end_line": 7,
          "code": "  %empty = icmp eq i64 %n, 0\n  br i1 %empty, label %exit, label %loop"
        },
        "loop_work": {
          "file": "byte-fill.before.ll",
          "line": 10,
          "end_line": 11,
          "code": "  %cell = getelementptr i8, ptr %dst, i64 %i\n  store i8 %value, ptr %cell, align 1"
        },
        "recognized_operation": {
          "file": "byte-fill.after.ll",
          "line": 12,
          "code": "  call void @llvm.memset.p0.i64(ptr align 1 %dst, i8 %value, i64 %n, i1 false)"
        }
      },
      "execution_forms": [
        {
          "file": "byte-fill.before.ll",
          "sha256": "1d38a461d31db6894371830ff970ee6b1a1ca5e6249d9632f6eca4d3f483f601",
          "status": "passed",
          "harness_case": 1,
          "mlir_flat_descriptor_abi": false,
          "cases": 17,
          "checked_buffer_bytes": 640,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "byte-fill.after.ll",
          "sha256": "496c2407887468b2749e5ead993ff75ed985df1ea109c2aff976a2a843eca087",
          "status": "passed",
          "harness_case": 1,
          "mlir_flat_descriptor_abi": false,
          "cases": 17,
          "checked_buffer_bytes": 640,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "byte-fill.cleaned.ll",
          "sha256": "e1e1fea8b23c4055f33b811c444eb8bc8a03447df22e06c6e8337d7f2341d5dd",
          "status": "passed",
          "harness_case": 1,
          "mlir_flat_descriptor_abi": false,
          "cases": 17,
          "checked_buffer_bytes": 640,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        }
      ]
    },
    {
      "id": "byte-copy",
      "input": "byte-copy.before.ll",
      "output": "byte-copy.after.ll",
      "pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
      "target_features": "generic/default",
      "actual_result": {
        "ordinary_memset": false,
        "memcpy": true,
        "memmove": false,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 0,
        "volatile_store_instructions": 0
      },
      "title": "서로 다른 저장 공간 사이의 연속 복사",
      "familiar": "for (uint64_t i = 0; i < n; ++i) dst[i] = src[i];",
      "meaning": "원본에서 한 바이트를 읽고 목적지에 씁니다. 명시한 noalias 계약 덕분에 두 영역의 간섭을 배제할 수 있어 llvm.memcpy가 생성됩니다.",
      "conditions": [
        "원본 n바이트는 읽을 수 있고 목적지 n바이트는 쓸 수 있습니다.",
        "이 예제의 noalias 계약을 만족하는 서로 다른 배열만 실행 검사에 사용합니다.",
        "변수 이름이 다르다는 사실은 noalias의 증명이 아닙니다. noalias는 실행 중 겹침을 검사하는 명령도 아닙니다."
      ],
      "warning": "현재 LLVM llvm.memcpy 명세는 시작 위치가 같거나 범위가 겹치지 않는 경우를 허용합니다. C memcpy와 구분합니다. 우리의 시작점이 다른 부분 겹침 반례는 이 조건을 만족하지 않습니다.",
      "generated": "@llvm.memcpy.",
      "cleaned": "byte-copy.cleaned.ll",
      "excerpts": {
        "signature": {
          "file": "byte-copy.before.ll",
          "line": 4,
          "code": "define void @byte_copy(ptr noalias %dst, ptr noalias readonly %src, i64 %n) {"
        },
        "empty_guard": {
          "file": "byte-copy.before.ll",
          "line": 6,
          "end_line": 7,
          "code": "  %empty = icmp eq i64 %n, 0\n  br i1 %empty, label %exit, label %loop"
        },
        "loop_work": {
          "file": "byte-copy.before.ll",
          "line": 10,
          "end_line": 13,
          "code": "  %from = getelementptr i8, ptr %src, i64 %i\n  %to = getelementptr i8, ptr %dst, i64 %i\n  %value = load i8, ptr %from, align 1\n  store i8 %value, ptr %to, align 1"
        },
        "recognized_operation": {
          "file": "byte-copy.after.ll",
          "line": 12,
          "code": "  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %dst, ptr align 1 %src, i64 %n, i1 false)"
        }
      },
      "execution_forms": [
        {
          "file": "byte-copy.before.ll",
          "sha256": "69cc6e1dd09a378fd718ee8fed0dbcbd6a1e51eb3a3f76f2c579e33ec26f04f5",
          "status": "passed",
          "harness_case": 2,
          "mlir_flat_descriptor_abi": false,
          "cases": 13,
          "checked_buffer_bytes": 960,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "byte-copy.after.ll",
          "sha256": "5c458ae698a43773a1166d169fab9570220c7466fdf28254be4ff06588cd862d",
          "status": "passed",
          "harness_case": 2,
          "mlir_flat_descriptor_abi": false,
          "cases": 13,
          "checked_buffer_bytes": 960,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "byte-copy.cleaned.ll",
          "sha256": "98b3124c54d231d7b3cd0c0060c0c1e31d4da2dc98c7743547ea983a289b0c61",
          "status": "passed",
          "harness_case": 2,
          "mlir_flat_descriptor_abi": false,
          "cases": 13,
          "checked_buffer_bytes": 960,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        }
      ]
    },
    {
      "id": "nonbyte-i32",
      "input": "nonbyte-i32.before.ll",
      "output": "nonbyte-i32.after.ll",
      "pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
      "target_features": "generic/default",
      "actual_result": {
        "ordinary_memset": false,
        "memcpy": false,
        "memmove": false,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 1,
        "volatile_store_instructions": 0
      },
      "title": "정수 1과 바이트 1 반복은 다릅니다",
      "familiar": "for (uint64_t i = 0; i < n; ++i) dst32[i] = 1;",
      "meaning": "이 x86-64 little-endian 대상의 i32 1은 01 00 00 00입니다. 일반 memset로 바이트 01을 반복하면 각 i32는 0x01010101, 즉 16843009가 됩니다. 그래서 이번 store i32 1은 일반 memset로 바뀌지 않습니다.",
      "conditions": [
        "각 원소는 4바이트 i32이고 맞는 정렬과 유효한 범위를 갖습니다.",
        "이 검사는 기본 x86_64-unknown-linux-gnu 설정입니다."
      ],
      "warning": "모든 i32 채우기가 불가능하다는 뜻은 아닙니다. 같은 바이트로 이뤄진 값과 대상에 따른 pattern 계열 intrinsic·옵션을 따로 구분합니다.",
      "excerpts": {
        "signature": {
          "file": "nonbyte-i32.before.ll",
          "line": 4,
          "code": "define void @nonbyte_i32(ptr %dst, i64 %n) {"
        },
        "empty_guard": {
          "file": "nonbyte-i32.before.ll",
          "line": 6,
          "end_line": 7,
          "code": "  %empty = icmp eq i64 %n, 0\n  br i1 %empty, label %exit, label %loop"
        },
        "loop_work": {
          "file": "nonbyte-i32.before.ll",
          "line": 10,
          "end_line": 11,
          "code": "  %cell = getelementptr i32, ptr %dst, i64 %i\n  store i32 1, ptr %cell, align 4"
        },
        "retained_store": {
          "file": "nonbyte-i32.after.ll",
          "line": 17,
          "code": "  store i32 1, ptr %cell, align 4"
        }
      },
      "execution_forms": [
        {
          "file": "nonbyte-i32.before.ll",
          "sha256": "f6b6af684e705d1e00a8d2613fa3c99d9ea4b66730cc58b7f98643d415c9cc8c",
          "status": "passed",
          "harness_case": 3,
          "mlir_flat_descriptor_abi": false,
          "cases": 5,
          "checked_buffer_bytes": 256,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "nonbyte-i32.after.ll",
          "sha256": "6074121041c6594a7a6cbf3949147dbafd4d6ed7201c3d021e127b6b968e54de",
          "status": "passed",
          "harness_case": 3,
          "mlir_flat_descriptor_abi": false,
          "cases": 5,
          "checked_buffer_bytes": 256,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        }
      ]
    },
    {
      "id": "stride-two",
      "input": "stride-two.before.ll",
      "output": "stride-two.after.ll",
      "pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
      "target_features": "generic/default",
      "actual_result": {
        "ordinary_memset": false,
        "memcpy": false,
        "memmove": false,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 1,
        "volatile_store_instructions": 0
      },
      "title": "한 칸씩 건너뛰는 쓰기는 빈칸을 지킵니다",
      "familiar": "for (uint64_t i = 0; i < n; ++i) dst[2 * i] = value;",
      "meaning": "한 번에 1바이트를 쓰지만 다음 주소는 2바이트 뒤입니다. 홀수 위치의 기존 값을 남겨야 하므로 전체 범위를 연속 memset로 덮으면 달라집니다. 현재 패스는 루프의 store를 남깁니다.",
      "conditions": [
        "쓰는 주소와 중간 빈칸을 포함하는 실제 버퍼를 제공합니다.",
        "guard 검사에서 쓰지 않아야 할 빈칸과 앞뒤 영역도 모두 비교했습니다."
      ],
      "warning": "다른 변환까지 모두 불가능하다는 뜻이 아닙니다. 이번 루프를 한 개의 연속 memset로 바꾸는 것이 맞지 않다는 반례입니다.",
      "excerpts": {
        "signature": {
          "file": "stride-two.before.ll",
          "line": 4,
          "code": "define void @stride_two(ptr %dst, i64 %n, i8 %value) {"
        },
        "empty_guard": {
          "file": "stride-two.before.ll",
          "line": 6,
          "end_line": 7,
          "code": "  %empty = icmp eq i64 %n, 0\n  br i1 %empty, label %exit, label %loop"
        },
        "loop_work": {
          "file": "stride-two.before.ll",
          "line": 10,
          "end_line": 12,
          "code": "  %offset = mul i64 %i, 2\n  %cell = getelementptr i8, ptr %dst, i64 %offset\n  store i8 %value, ptr %cell, align 1"
        },
        "retained_store": {
          "file": "stride-two.after.ll",
          "line": 18,
          "code": "  store i8 %value, ptr %cell, align 1"
        }
      },
      "execution_forms": [
        {
          "file": "stride-two.before.ll",
          "sha256": "3965989d6f27682a7e8f25c200a37074c7ecaa85879fef2b62c4d2da1826e867",
          "status": "passed",
          "harness_case": 4,
          "mlir_flat_descriptor_abi": false,
          "cases": 17,
          "checked_buffer_bytes": 640,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "stride-two.after.ll",
          "sha256": "98ebeb21c4421c4fb6ad267e8453b71b1f6cadfe9050f9f8c874a3970e93cb36",
          "status": "passed",
          "harness_case": 4,
          "mlir_flat_descriptor_abi": false,
          "cases": 17,
          "checked_buffer_bytes": 640,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        }
      ]
    },
    {
      "id": "volatile-fill",
      "input": "volatile-fill.before.ll",
      "output": "volatile-fill.after.ll",
      "pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
      "target_features": "generic/default",
      "actual_result": {
        "ordinary_memset": false,
        "memcpy": false,
        "memmove": false,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 1,
        "volatile_store_instructions": 1
      },
      "title": "volatile 쓰기의 관찰 규칙을 지킵니다",
      "familiar": "for (uint64_t i = 0; i < n; ++i) volatile_dst[i] = value;",
      "meaning": "현재 LoopIdiomRecognize는 이 volatile store를 합쳐 일반 memset로 바꾸지 않습니다. 실제 출력에도 store volatile이 남습니다.",
      "conditions": [
        "버퍼 내용은 변환 전후 실행으로 비교했습니다.",
        "volatile store의 유지 여부는 IR에서 별도로 검사했습니다."
      ],
      "warning": "메모리 intrinsic에도 volatile 인수가 있다는 사실과 이 패스가 개별 volatile store들을 합칠 수 있다는 주장은 다릅니다. 장치 이벤트나 volatile 접근 횟수를 실행 하네스로 측정한 것은 아닙니다.",
      "excerpts": {
        "signature": {
          "file": "volatile-fill.before.ll",
          "line": 4,
          "code": "define void @volatile_fill(ptr %dst, i64 %n, i8 %value) {"
        },
        "empty_guard": {
          "file": "volatile-fill.before.ll",
          "line": 6,
          "end_line": 7,
          "code": "  %empty = icmp eq i64 %n, 0\n  br i1 %empty, label %exit, label %loop"
        },
        "loop_work": {
          "file": "volatile-fill.before.ll",
          "line": 10,
          "end_line": 11,
          "code": "  %cell = getelementptr i8, ptr %dst, i64 %i\n  store volatile i8 %value, ptr %cell, align 1"
        },
        "retained_store": {
          "file": "volatile-fill.after.ll",
          "line": 17,
          "code": "  store volatile i8 %value, ptr %cell, align 1"
        }
      },
      "execution_forms": [
        {
          "file": "volatile-fill.before.ll",
          "sha256": "3f666abd58774afd552cb7740dfd1d16ad32ff0176508f0d7dd42f42f922465c",
          "status": "passed",
          "harness_case": 5,
          "mlir_flat_descriptor_abi": false,
          "cases": 17,
          "checked_buffer_bytes": 640,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "volatile-fill.after.ll",
          "sha256": "a47e15414815d0732a2d791a0cb3fdee3f94effa9db45b3266fb3c51bb93deae",
          "status": "passed",
          "harness_case": 5,
          "mlir_flat_descriptor_abi": false,
          "cases": 17,
          "checked_buffer_bytes": 640,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        }
      ]
    },
    {
      "id": "overlap-forward",
      "input": "overlap-forward.before.ll",
      "output": "overlap-forward.after.ll",
      "pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
      "target_features": "generic/default",
      "actual_result": {
        "ordinary_memset": false,
        "memcpy": false,
        "memmove": false,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 1,
        "volatile_store_instructions": 0
      },
      "title": "겹친 오른쪽 복사는 앞의 쓰기를 다시 읽습니다",
      "familiar": "for (uint64_t i = 0; i < n; ++i) buffer[i + 1] = buffer[i];",
      "meaning": "n>=2이면 시작점이 다른 범위가 부분적으로 겹칩니다. 앞에서 쓴 값을 다음 회차가 다시 읽습니다. [1,2,3,4,5,6]에서 n=5이면 [1,1,1,1,1,1]이 됩니다. snapshot 방식 memmove 결과 [1,1,2,3,4,5]와 다릅니다. 이번 출력은 읽기·쓰기를 남깁니다.",
      "conditions": [
        "한 버퍼에 n+1바이트를 사용할 수 있게 제공합니다.",
        "이 함수에는 noalias 계약을 주지 않습니다.",
        "n=0,1도 검사하지만 부분 겹침을 설명하는 숫자 예시는 n>=2를 사용합니다."
      ],
      "warning": "겹친 모든 복사를 memmove로 바꾸면 된다는 설명은 틀립니다. 원래 순서에 따른 결과를 먼저 확인해야 합니다.",
      "excerpts": {
        "signature": {
          "file": "overlap-forward.before.ll",
          "line": 4,
          "code": "define void @overlap_forward(ptr %buffer, i64 %n) {"
        },
        "empty_guard": {
          "file": "overlap-forward.before.ll",
          "line": 6,
          "end_line": 7,
          "code": "  %empty = icmp eq i64 %n, 0\n  br i1 %empty, label %exit, label %loop"
        },
        "loop_work": {
          "file": "overlap-forward.before.ll",
          "line": 10,
          "end_line": 14,
          "code": "  %from = getelementptr i8, ptr %buffer, i64 %i\n  %to_index = add nuw i64 %i, 1\n  %to = getelementptr i8, ptr %buffer, i64 %to_index\n  %value = load i8, ptr %from, align 1\n  store i8 %value, ptr %to, align 1"
        },
        "retained_store": {
          "file": "overlap-forward.after.ll",
          "line": 20,
          "code": "  store i8 %value, ptr %to, align 1"
        }
      },
      "execution_forms": [
        {
          "file": "overlap-forward.before.ll",
          "sha256": "510e82728a189d70e93a8a9ee6e1344c033ba61f132493d416bb815bb7c589c8",
          "status": "passed",
          "harness_case": 6,
          "mlir_flat_descriptor_abi": false,
          "cases": 13,
          "checked_buffer_bytes": 480,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "overlap-forward.after.ll",
          "sha256": "32f7a8737e5e4d14353298ad281ba4a72bb24c97c99b9f6f4c8121431f8ffc26",
          "status": "passed",
          "harness_case": 6,
          "mlir_flat_descriptor_abi": false,
          "cases": 13,
          "checked_buffer_bytes": 480,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        }
      ]
    },
    {
      "id": "popcount",
      "input": "popcount.before.ll",
      "output": "popcount.after.ll",
      "pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
      "target_features": "+popcnt",
      "actual_result": {
        "ordinary_memset": false,
        "memcpy": false,
        "memmove": false,
        "ctpop": true,
        "experimental_memset_pattern": false,
        "store_instructions": 0,
        "volatile_store_instructions": 0
      },
      "title": "최하위의 1비트를 하나씩 없애며 세기",
      "familiar": "unsigned count = 0; while (x != 0) { x &= x - 1; ++count; }",
      "meaning": "x=13, 즉 1101이면 1100 → 1000 → 0000으로 세 번 바뀝니다. 결과는 켜진 비트 수 3입니다. 현재 구현은 빠른 하드웨어 popcount 지원을 검사합니다. +popcnt를 켠 x86 대상에서 llvm.ctpop가 생성됐고 기본 대상에서는 생성되지 않았습니다.",
      "conditions": [
        "input은 i64 비트열이고 결과는 0부터 64까지의 i32입니다.",
        "-mattr=+popcnt를 준 결과와 주지 않은 결과를 별도 파일로 제공합니다.",
        "0을 포함한 12개 입력을 확인했습니다."
      ],
      "warning": "ctpop 생성은 최종 CPU 명령 한 개가 나온다는 측정이 아닙니다. 인식 출력에는 원래 루프 골격이 남고, cleaned 파일은 후속 loop-deletion과 simplifycfg를 추가한 결과입니다.",
      "generated": "@llvm.ctpop.",
      "cleaned": "popcount.cleaned.ll",
      "generic": "popcount.generic.after.ll",
      "excerpts": {
        "signature": {
          "file": "popcount.before.ll",
          "line": 4,
          "code": "define i32 @count_bits(i64 %input) {"
        },
        "empty_guard": {
          "file": "popcount.before.ll",
          "line": 6,
          "end_line": 7,
          "code": "  %empty = icmp eq i64 %input, 0\n  br i1 %empty, label %exit, label %loop"
        },
        "loop_work": {
          "file": "popcount.before.ll",
          "line": 11,
          "end_line": 13,
          "code": "  %minus_one = add i64 %x, -1\n  %remaining = and i64 %x, %minus_one\n  %next_count = add i32 %count, 1"
        },
        "recognized_operation": {
          "file": "popcount.after.ll",
          "line": 8,
          "code": "  %0 = call i64 @llvm.ctpop.i64(i64 %input)"
        },
        "feature_contract": {
          "file": "popcount.after.ll",
          "line": 39,
          "code": "attributes #0 = { \"target-features\"=\"+popcnt\" }"
        }
      },
      "execution_forms": [
        {
          "file": "popcount.before.ll",
          "sha256": "3b03c53596fc9bbf35bc4811f265f828bdd3ce868b7bc023a6bc42b2fcf0c21a",
          "status": "passed",
          "harness_case": 7,
          "mlir_flat_descriptor_abi": false,
          "cases": 12,
          "checked_buffer_bytes": 0,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "popcount.after.ll",
          "sha256": "19d2477e133420ac0fff91c0107a7c4cac17eb5b22d6a58506adb5426984ef7a",
          "status": "passed",
          "harness_case": 7,
          "mlir_flat_descriptor_abi": false,
          "cases": 12,
          "checked_buffer_bytes": 0,
          "native_compile_diagnostics": "'+popcnt' is not a recognized feature for this target (ignoring feature)\n'+popcnt' is not a recognized feature for this target (ignoring feature)\nld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": {
            "reason": "Apple clang 21 does not parse the LLVM 24 optimizer attribute.",
            "removed_optimizer_attributes": [
              "nocreateundeforpoison"
            ],
            "function_definitions_and_bodies_unchanged": true,
            "only_difference": "Removal of this attribute token, including its comment listing.",
            "native_input_file": "popcount.after.clang21.ll",
            "native_input_sha256": "af19df7aba5f081a1b52dd464173cd48187da7f9eb6715f45d5441067e1a7623"
          }
        },
        {
          "file": "popcount.generic.after.ll",
          "sha256": "5814f75a035b8c12100c1f7945087a575a3bcd824802e4d85682aa13e17d99ee",
          "status": "passed",
          "harness_case": 7,
          "mlir_flat_descriptor_abi": false,
          "cases": 12,
          "checked_buffer_bytes": 0,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "popcount.cleaned.ll",
          "sha256": "58a0e03c9ce05084a19931338a2f01d815cc58a8a74df5807778b52f81b4b9fb",
          "status": "passed",
          "harness_case": 7,
          "mlir_flat_descriptor_abi": false,
          "cases": 12,
          "checked_buffer_bytes": 0,
          "native_compile_diagnostics": "'+popcnt' is not a recognized feature for this target (ignoring feature)\n'+popcnt' is not a recognized feature for this target (ignoring feature)\nld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": {
            "reason": "Apple clang 21 does not parse the LLVM 24 optimizer attribute.",
            "removed_optimizer_attributes": [
              "nocreateundeforpoison"
            ],
            "function_definitions_and_bodies_unchanged": true,
            "only_difference": "Removal of this attribute token, including its comment listing.",
            "native_input_file": "popcount.cleaned.clang21.ll",
            "native_input_sha256": "5962ee4331481636f2277d766210870f1a0167e5eeb6f8eb79aeaf7f5d4b3909"
          }
        }
      ]
    },
    {
      "id": "overlap-leftshift",
      "input": "overlap-leftshift.before.ll",
      "output": "overlap-leftshift.after.ll",
      "pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
      "target_features": "generic/default",
      "actual_result": {
        "ordinary_memset": false,
        "memcpy": false,
        "memmove": true,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 0,
        "volatile_store_instructions": 0
      },
      "title": "반대 방향에서는 memmove가 가능한 예가 있습니다",
      "familiar": "for (uint64_t i = 0; i < n; ++i) buffer[i] = buffer[i + 1];",
      "meaning": "앞으로 진행하며 왼쪽으로 옮깁니다. 각 회차는 아직 덮어쓰지 않은 오른쪽 값을 읽습니다. 이 예제는 llvm.memmove로 바뀌었습니다. 오른쪽 전파 복사와 원래 계산의 의미가 다릅니다.",
      "conditions": [
        "한 버퍼의 n+1바이트가 유효합니다.",
        "현재 패스가 같은 기반 객체, 일정한 주소 차이와 진행 방향을 확인할 수 있는 모양입니다."
      ],
      "warning": "겹침 자체가 언제나 불가능한 이유는 아닙니다. 어떤 순서로 무엇을 읽는지를 따져야 합니다.",
      "generated": "@llvm.memmove.",
      "excerpts": {
        "signature": {
          "file": "overlap-leftshift.before.ll",
          "line": 4,
          "code": "define void @overlap_leftshift(ptr %buffer, i64 %n) {"
        },
        "empty_guard": {
          "file": "overlap-leftshift.before.ll",
          "line": 6,
          "end_line": 7,
          "code": "  %empty = icmp eq i64 %n, 0\n  br i1 %empty, label %exit, label %loop"
        },
        "loop_work": {
          "file": "overlap-leftshift.before.ll",
          "line": 10,
          "end_line": 14,
          "code": "  %from_index = add nuw i64 %i, 1\n  %from = getelementptr i8, ptr %buffer, i64 %from_index\n  %to = getelementptr i8, ptr %buffer, i64 %i\n  %value = load i8, ptr %from, align 1\n  store i8 %value, ptr %to, align 1"
        },
        "recognized_operation": {
          "file": "overlap-leftshift.after.ll",
          "line": 13,
          "code": "  call void @llvm.memmove.p0.p0.i64(ptr align 1 %buffer, ptr align 1 %scevgep, i64 %n, i1 false)"
        }
      },
      "execution_forms": [
        {
          "file": "overlap-leftshift.before.ll",
          "sha256": "a074690656838adf6ec292be26ccafa01539c80df4517b90fcc0457862339fb4",
          "status": "passed",
          "harness_case": 8,
          "mlir_flat_descriptor_abi": false,
          "cases": 13,
          "checked_buffer_bytes": 480,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        },
        {
          "file": "overlap-leftshift.after.ll",
          "sha256": "3a32fbfd318cfb1b2db63a1abc7d097e8c1f2a4276014c3339b6b40b6f548798",
          "status": "passed",
          "harness_case": 8,
          "mlir_flat_descriptor_abi": false,
          "cases": 13,
          "checked_buffer_bytes": 480,
          "native_compile_diagnostics": "ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/usr/local/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly",
          "parser_compatibility_adjustment": null
        }
      ]
    }
  ],
  "mlir_examples": [
    {
      "id": "byte-fill",
      "input_mlir": "byte-fill.before.mlir",
      "llvm_dialect": "mlir-byte-fill.llvm-dialect.mlir",
      "lowered_llvm": "mlir-byte-fill.lowered.ll",
      "direct_loop_idiom_output": "mlir-byte-fill.recognized.ll",
      "direct_pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
      "direct_result": {
        "ordinary_memset": false,
        "memcpy": false,
        "memmove": false,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 1,
        "volatile_store_instructions": 0
      },
      "prepared_loop_idiom_output": "mlir-byte-fill.prepared-recognized.ll",
      "prepared_pipeline": "function(instcombine,loop-simplify,lcssa,loop(loop-rotate,loop-idiom))",
      "prepared_result": {
        "ordinary_memset": true,
        "memcpy": false,
        "memmove": false,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 0,
        "volatile_store_instructions": 0
      },
      "excerpts": {
        "source_loop": {
          "file": "byte-fill.before.mlir",
          "line": 5,
          "end_line": 7,
          "code": "    scf.for %i = %c0 to %n step %c1 {\n      memref.store %value, %dst[%i] : memref<?xi8>\n    }"
        },
        "lowered_signature": {
          "file": "mlir-byte-fill.lowered.ll",
          "line": 6,
          "code": "define void @mlir_byte_fill(ptr %0, ptr %1, i64 %2, i64 %3, i64 %4, i64 %5, i8 %6) {"
        },
        "generated_call": {
          "file": "mlir-byte-fill.prepared-recognized.ll",
          "line": 11,
          "code": "  call void @llvm.memset.p0.i64(ptr align 1 %1, i8 %6, i64 %5, i1 false)"
        }
      },
      "preconditions": [
        "memref<?xi8> has identity layout. Offset 0 and stride 1 are statically required, even though the descriptor ABI includes corresponding fields.",
        "n is nonnegative, fits signed i64, and does not exceed the supplied memref size.",
        "The native harness supplies allocated pointer, aligned pointer, offset 0, size, stride 1, then the explicit n and value as required."
      ],
      "explanation_ko": [
        "이 입력의 memref<?xi8>는 identity layout입니다. offset 0과 stride 1이 타입에 정해져 있으므로 임의 배치의 memref를 지원한다는 뜻이 아닙니다.",
        "기본 descriptor ABI는 allocated pointer, aligned pointer, offset, size, stride를 각각 인수로 넘깁니다. 손으로 쓴 LLVM의 단순 ptr·n 인터페이스와 다릅니다.",
        "MLIR 낮추기와 번역만 수행하면 메모리 intrinsic은 아직 없습니다. 직접 loop-idiom 준비 파이프라인만 적용해도 이번 모양에서는 생기지 않았습니다.",
        "instcombine은 descriptor를 조립했다 꺼내는 표현을 정리합니다. loop-rotate는 이 header 검사 루프를 인식하기 쉬운 모양으로 바꿉니다. 그 준비 뒤의 loop-idiom에서 메모리 intrinsic이 생성됐습니다.",
        "이를 MLIR에 LLVM loop-idiom와 완전히 같은 패스가 있다는 근거로 쓰지 않습니다. 변환이 일어난 단계는 실제로 낮춘 LLVM IR입니다."
      ]
    },
    {
      "id": "byte-copy",
      "input_mlir": "byte-copy.before.mlir",
      "llvm_dialect": "mlir-byte-copy.llvm-dialect.mlir",
      "lowered_llvm": "mlir-byte-copy.lowered.ll",
      "direct_loop_idiom_output": "mlir-byte-copy.recognized.ll",
      "direct_pipeline": "function(loop-simplify,lcssa,loop(loop-idiom))",
      "direct_result": {
        "ordinary_memset": false,
        "memcpy": false,
        "memmove": false,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 1,
        "volatile_store_instructions": 0
      },
      "prepared_loop_idiom_output": "mlir-byte-copy.prepared-recognized.ll",
      "prepared_pipeline": "function(instcombine,loop-simplify,lcssa,loop(loop-rotate,loop-idiom))",
      "prepared_result": {
        "ordinary_memset": false,
        "memcpy": true,
        "memmove": false,
        "ctpop": false,
        "experimental_memset_pattern": false,
        "store_instructions": 0,
        "volatile_store_instructions": 0
      },
      "excerpts": {
        "source_loop": {
          "file": "byte-copy.before.mlir",
          "line": 6,
          "end_line": 9,
          "code": "    scf.for %i = %c0 to %n step %c1 {\n      %value = memref.load %separate_src[%i] : memref<?xi8>\n      memref.store %value, %separate_dst[%i] : memref<?xi8>\n    }"
        },
        "lowered_signature": {
          "file": "mlir-byte-copy.lowered.ll",
          "line": 6,
          "code": "define void @mlir_byte_copy(ptr %0, ptr %1, i64 %2, i64 %3, i64 %4, ptr %5, ptr %6, i64 %7, i64 %8, i64 %9, i64 %10) {"
        },
        "generated_call": {
          "file": "mlir-byte-copy.prepared-recognized.ll",
          "line": 12,
          "code": "  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %1, ptr align 1 %6, i64 %10, i1 false)"
        },
        "supplied_alias_contract": {
          "file": "byte-copy.before.mlir",
          "line": 3,
          "code": "    %separate_dst, %separate_src = memref.distinct_objects %dst, %src : memref<?xi8>, memref<?xi8>"
        },
        "lowered_alias_assumption": {
          "file": "mlir-byte-copy.lowered.ll",
          "line": 19,
          "code": "  call void @llvm.assume(i1 true) [ \"separate_storage\"(ptr %22, ptr %23) ]"
        }
      },
      "preconditions": [
        "memref<?xi8> has identity layout. Offset 0 and stride 1 are statically required, even though the descriptor ABI includes corresponding fields.",
        "n is nonnegative, fits signed i64, and does not exceed the supplied memref size.",
        "The native harness supplies allocated pointer, aligned pointer, offset 0, size, stride 1, then the explicit n and value as required."
      ],
      "explanation_ko": [
        "이 입력의 memref<?xi8>는 identity layout입니다. offset 0과 stride 1이 타입에 정해져 있으므로 임의 배치의 memref를 지원한다는 뜻이 아닙니다.",
        "기본 descriptor ABI는 allocated pointer, aligned pointer, offset, size, stride를 각각 인수로 넘깁니다. 손으로 쓴 LLVM의 단순 ptr·n 인터페이스와 다릅니다.",
        "MLIR 낮추기와 번역만 수행하면 메모리 intrinsic은 아직 없습니다. 직접 loop-idiom 준비 파이프라인만 적용해도 이번 모양에서는 생기지 않았습니다.",
        "instcombine은 descriptor를 조립했다 꺼내는 표현을 정리합니다. loop-rotate는 이 header 검사 루프를 인식하기 쉬운 모양으로 바꿉니다. 그 준비 뒤의 loop-idiom에서 메모리 intrinsic이 생성됐습니다.",
        "이를 MLIR에 LLVM loop-idiom와 완전히 같은 패스가 있다는 근거로 쓰지 않습니다. 변환이 일어난 단계는 실제로 낮춘 LLVM IR입니다.",
        "copy는 memref.distinct_objects로 서로 다른 저장 공간이라는 전제를 명시합니다. 낮추면 separate_storage 가정이 됩니다. 새 버퍼를 만들거나 실행 중 겹침을 검사하는 연산이 아닙니다."
      ]
    }
  ],
  "sources": [
    {
      "title": "LoopIdiomRecognize implementation",
      "url": "https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp",
      "supports": "Bytewise values, stride, volatile checks, alias checks, memmove direction, target popcount support."
    },
    {
      "title": "LLVM memset intrinsic",
      "url": "https://llvm.org/docs/LangRef.html#llvm-memset-intrinsics",
      "supports": "Byte fill, byte count, volatile parameter, target-independent meaning."
    },
    {
      "title": "LLVM memcpy intrinsic",
      "url": "https://llvm.org/docs/LangRef.html#llvm-memcpy-intrinsic",
      "supports": "Byte count and the current equal-or-non-overlapping source/destination rule."
    },
    {
      "title": "LLVM memmove intrinsic",
      "url": "https://llvm.org/docs/LangRef.html#llvm-memmove-intrinsic",
      "supports": "Copy semantics with potentially overlapping ranges."
    },
    {
      "title": "LLVM ctpop intrinsic",
      "url": "https://llvm.org/docs/LangRef.html#llvm-ctpop-intrinsic",
      "supports": "Number of set bits in an integer bit pattern."
    },
    {
      "title": "MLIR SCF for",
      "url": "https://mlir.llvm.org/docs/Dialects/SCFDialect/#scffor-scfforop",
      "supports": "Structured loop and its range/step."
    },
    {
      "title": "MLIR distinct_objects",
      "url": "https://mlir.llvm.org/docs/Dialects/MemRef/#memrefdistinct_objects-memrefdistinctobjectsop",
      "supports": "A supplied non-aliasing assumption; aliasing violates the contract."
    },
    {
      "title": "MLIR LLVM IR target",
      "url": "https://mlir.llvm.org/docs/TargetLLVMIR/",
      "supports": "Index lowering, static layout information, descriptor fields, expanded ABI."
    }
  ],
  "validation_file": "validation.json",
  "commands_file": "commands.json",
  "summary": {
    "total_native_execution_forms": 26,
    "total_finite_cases": 352,
    "total_checked_buffer_bytes": 14592,
    "parsed_verified_llvm_files": 28,
    "parsed_verified_mlir_files": 4
  },
  "scope_notes_ko": [
    "작성한 입력 IR은 설명용 원본입니다. C를 clang으로 컴파일한 결과라고 표시하지 않습니다.",
    "변환 후 LLVM IR은 실제 패스 출력 그대로입니다. cleaned는 인식과 별도로 후속 패스를 더한 결과입니다.",
    "x86-64 Linux를 지정한 인식 검사와 ARM macOS에서 수행한 함수 의미 검사는 구분합니다. 실행 시간이나 x86 기계어 성능을 측정하지 않았습니다.",
    "popcount의 after·cleaned native 실행은 Apple clang 21이 모르는 최적화 속성 nocreateundeforpoison만 제거한 별도 clang21 파일을 사용했습니다. 함수 본문과 호출·연산이 같음을 검사했고, 원본과 호환판 모두 LLVM 24 verifier를 통과했습니다. 원본을 그대로 Apple clang 21로 실행했다고 쓰지 않습니다.",
    "popcount의 +popcnt 기능은 x86 인식 비용 판단에 사용했습니다. ARM host 재컴파일에서는 이 대상 기능이 무시된다는 경고가 있었고 검증 기록에 남겼습니다.",
    "버퍼의 최종 내용과 쓰면 안 되는 앞뒤 영역·stride 빈칸, 원본 버퍼 유지, 0회 반복을 검사했습니다. volatile 장치 이벤트는 측정하지 않았습니다.",
    "모든 입력에 대한 증명, 모든 대상의 지원, 가능한 모든 최적화를 확인한 것은 아닙니다."
  ]
}
