1 // GENERATED FILE - DO NOT EDIT. 2 // Generated by generate_tests.py 3 // 4 // Copyright (c) 2022 Google LLC. 5 // 6 // Licensed under the Apache License, Version 2.0 (the "License"); 7 // you may not use this file except in compliance with the License. 8 // You may obtain a copy of the License at 9 // 10 // http://www.apache.org/licenses/LICENSE-2.0 11 // 12 // Unless required by applicable law or agreed to in writing, software 13 // distributed under the License is distributed on an "AS IS" BASIS, 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 // See the License for the specific language governing permissions and 16 // limitations under the License. 17 18 #include "../diff_test_utils.h" 19 20 #include "gtest/gtest.h" 21 22 namespace spvtools { 23 namespace diff { 24 namespace { 25 26 // Test where src and dst have many small functions with small differences. 27 constexpr char kSrc[] = R"( OpCapability Shader 28 %1 = OpExtInstImport "GLSL.std.450" 29 OpMemoryModel Logical GLSL450 30 OpEntryPoint GLCompute %4 "main" 31 OpExecutionMode %4 LocalSize 1 1 1 32 OpSource ESSL 310 33 OpName %4 "main" 34 OpName %6 "f1(" 35 OpName %8 "f2(" 36 OpName %10 "f3(" 37 OpName %12 "f4(" 38 OpName %14 "f5(" 39 OpName %17 "BufferOut" 40 OpMemberName %17 0 "o" 41 OpName %19 "" 42 OpName %22 "BufferIn" 43 OpMemberName %22 0 "i" 44 OpName %24 "" 45 OpMemberDecorate %17 0 Offset 0 46 OpDecorate %17 BufferBlock 47 OpDecorate %19 DescriptorSet 0 48 OpDecorate %19 Binding 1 49 OpMemberDecorate %22 0 Offset 0 50 OpDecorate %22 Block 51 OpDecorate %24 DescriptorSet 0 52 OpDecorate %24 Binding 0 53 %2 = OpTypeVoid 54 %3 = OpTypeFunction %2 55 %16 = OpTypeInt 32 0 56 %17 = OpTypeStruct %16 57 %18 = OpTypePointer Uniform %17 58 %19 = OpVariable %18 Uniform 59 %20 = OpTypeInt 32 1 60 %21 = OpConstant %20 0 61 %22 = OpTypeStruct %16 62 %23 = OpTypePointer Uniform %22 63 %24 = OpVariable %23 Uniform 64 %25 = OpTypePointer Uniform %16 65 %31 = OpConstant %20 1 66 %36 = OpConstant %16 2 67 %4 = OpFunction %2 None %3 68 %5 = OpLabel 69 %45 = OpFunctionCall %2 %6 70 %46 = OpFunctionCall %2 %8 71 %47 = OpFunctionCall %2 %10 72 %48 = OpFunctionCall %2 %12 73 %49 = OpFunctionCall %2 %14 74 OpReturn 75 OpFunctionEnd 76 %6 = OpFunction %2 None %3 77 %7 = OpLabel 78 %26 = OpAccessChain %25 %24 %21 79 %27 = OpLoad %16 %26 80 %28 = OpAccessChain %25 %19 %21 81 OpStore %28 %27 82 OpReturn 83 OpFunctionEnd 84 %8 = OpFunction %2 None %3 85 %9 = OpLabel 86 %29 = OpAccessChain %25 %19 %21 87 %30 = OpLoad %16 %29 88 %32 = OpIAdd %16 %30 %31 89 OpStore %29 %32 90 OpReturn 91 OpFunctionEnd 92 %10 = OpFunction %2 None %3 93 %11 = OpLabel 94 %33 = OpAccessChain %25 %19 %21 95 %34 = OpLoad %16 %33 96 %35 = OpISub %16 %34 %31 97 OpStore %33 %35 98 OpReturn 99 OpFunctionEnd 100 %12 = OpFunction %2 None %3 101 %13 = OpLabel 102 %37 = OpAccessChain %25 %19 %21 103 %38 = OpLoad %16 %37 104 %39 = OpIMul %16 %38 %36 105 %40 = OpAccessChain %25 %19 %21 106 OpStore %40 %39 107 OpReturn 108 OpFunctionEnd 109 %14 = OpFunction %2 None %3 110 %15 = OpLabel 111 %41 = OpAccessChain %25 %19 %21 112 %42 = OpLoad %16 %41 113 %43 = OpUDiv %16 %42 %36 114 %44 = OpAccessChain %25 %19 %21 115 OpStore %44 %43 116 OpReturn 117 OpFunctionEnd 118 )"; 119 constexpr char kDst[] = R"( OpCapability Shader 120 %1 = OpExtInstImport "GLSL.std.450" 121 OpMemoryModel Logical GLSL450 122 OpEntryPoint GLCompute %4 "main" 123 OpExecutionMode %4 LocalSize 1 1 1 124 OpSource ESSL 310 125 OpName %4 "main" 126 OpName %6 "f1(" 127 OpName %8 "f2(" 128 OpName %10 "f3(" 129 OpName %12 "f4(" 130 OpName %14 "f5(" 131 OpName %17 "BufferOut" 132 OpMemberName %17 0 "o" 133 OpName %19 "" 134 OpName %22 "BufferIn" 135 OpMemberName %22 0 "i" 136 OpName %24 "" 137 OpMemberDecorate %17 0 Offset 0 138 OpDecorate %17 BufferBlock 139 OpDecorate %19 DescriptorSet 0 140 OpDecorate %19 Binding 1 141 OpMemberDecorate %22 0 Offset 0 142 OpDecorate %22 Block 143 OpDecorate %24 DescriptorSet 0 144 OpDecorate %24 Binding 0 145 %2 = OpTypeVoid 146 %3 = OpTypeFunction %2 147 %16 = OpTypeInt 32 0 148 %17 = OpTypeStruct %16 149 %18 = OpTypePointer Uniform %17 150 %19 = OpVariable %18 Uniform 151 %20 = OpTypeInt 32 1 152 %21 = OpConstant %20 0 153 %22 = OpTypeStruct %16 154 %23 = OpTypePointer Uniform %22 155 %24 = OpVariable %23 Uniform 156 %25 = OpTypePointer Uniform %16 157 %31 = OpConstant %20 1 158 %36 = OpConstant %16 2 159 %6 = OpFunction %2 None %3 160 %7 = OpLabel 161 %26 = OpAccessChain %25 %24 %21 162 %27 = OpLoad %16 %26 163 %28 = OpAccessChain %25 %19 %21 164 OpStore %28 %27 165 OpReturn 166 OpFunctionEnd 167 %14 = OpFunction %2 None %3 168 %15 = OpLabel 169 %41 = OpAccessChain %25 %19 %21 170 %42 = OpLoad %16 %41 171 %43 = OpIAdd %16 %42 %36 172 %44 = OpAccessChain %25 %19 %21 173 OpStore %44 %43 174 OpReturn 175 OpFunctionEnd 176 %8 = OpFunction %2 None %3 177 %9 = OpLabel 178 %29 = OpAccessChain %25 %19 %21 179 %30 = OpLoad %16 %29 180 %32 = OpISub %16 %30 %31 181 OpStore %29 %32 182 OpReturn 183 OpFunctionEnd 184 %10 = OpFunction %2 None %3 185 %11 = OpLabel 186 %33 = OpAccessChain %25 %19 %21 187 %34 = OpLoad %16 %33 188 %35 = OpIAdd %16 %34 %31 189 OpStore %33 %35 190 OpReturn 191 OpFunctionEnd 192 %4 = OpFunction %2 None %3 193 %5 = OpLabel 194 %45 = OpFunctionCall %2 %6 195 %46 = OpFunctionCall %2 %8 196 %47 = OpFunctionCall %2 %10 197 %48 = OpFunctionCall %2 %12 198 %49 = OpFunctionCall %2 %14 199 OpReturn 200 OpFunctionEnd 201 %12 = OpFunction %2 None %3 202 %13 = OpLabel 203 %37 = OpAccessChain %25 %19 %21 204 %38 = OpLoad %16 %37 205 %39 = OpISub %16 %38 %36 206 %40 = OpAccessChain %25 %19 %21 207 OpStore %40 %39 208 OpReturn 209 OpFunctionEnd 210 211 )"; 212 213 TEST(DiffTest, SmallFunctionsSmallDiffs) { 214 constexpr char kDiff[] = R"( ; SPIR-V 215 ; Version: 1.6 216 ; Generator: Khronos SPIR-V Tools Assembler; 0 217 -; Bound: 50 218 +; Bound: 54 219 ; Schema: 0 220 OpCapability Shader 221 %1 = OpExtInstImport "GLSL.std.450" 222 OpMemoryModel Logical GLSL450 223 OpEntryPoint GLCompute %4 "main" 224 OpExecutionMode %4 LocalSize 1 1 1 225 OpSource ESSL 310 226 OpName %4 "main" 227 OpName %6 "f1(" 228 OpName %8 "f2(" 229 OpName %10 "f3(" 230 OpName %12 "f4(" 231 OpName %14 "f5(" 232 OpName %17 "BufferOut" 233 OpMemberName %17 0 "o" 234 OpName %19 "" 235 OpName %22 "BufferIn" 236 OpMemberName %22 0 "i" 237 OpName %24 "" 238 OpMemberDecorate %17 0 Offset 0 239 OpDecorate %17 BufferBlock 240 OpDecorate %19 DescriptorSet 0 241 OpDecorate %19 Binding 1 242 OpMemberDecorate %22 0 Offset 0 243 OpDecorate %22 Block 244 OpDecorate %24 DescriptorSet 0 245 OpDecorate %24 Binding 0 246 %2 = OpTypeVoid 247 %3 = OpTypeFunction %2 248 %16 = OpTypeInt 32 0 249 %17 = OpTypeStruct %16 250 %18 = OpTypePointer Uniform %17 251 %19 = OpVariable %18 Uniform 252 %20 = OpTypeInt 32 1 253 %21 = OpConstant %20 0 254 %22 = OpTypeStruct %16 255 %23 = OpTypePointer Uniform %22 256 %24 = OpVariable %23 Uniform 257 %25 = OpTypePointer Uniform %16 258 %31 = OpConstant %20 1 259 %36 = OpConstant %16 2 260 %4 = OpFunction %2 None %3 261 %5 = OpLabel 262 %45 = OpFunctionCall %2 %6 263 %46 = OpFunctionCall %2 %8 264 %47 = OpFunctionCall %2 %10 265 %48 = OpFunctionCall %2 %12 266 %49 = OpFunctionCall %2 %14 267 OpReturn 268 OpFunctionEnd 269 %6 = OpFunction %2 None %3 270 %7 = OpLabel 271 %26 = OpAccessChain %25 %24 %21 272 %27 = OpLoad %16 %26 273 %28 = OpAccessChain %25 %19 %21 274 OpStore %28 %27 275 OpReturn 276 OpFunctionEnd 277 %8 = OpFunction %2 None %3 278 %9 = OpLabel 279 %29 = OpAccessChain %25 %19 %21 280 %30 = OpLoad %16 %29 281 -%32 = OpIAdd %16 %30 %31 282 +%50 = OpISub %16 %30 %31 283 -OpStore %29 %32 284 +OpStore %29 %50 285 OpReturn 286 OpFunctionEnd 287 %10 = OpFunction %2 None %3 288 %11 = OpLabel 289 %33 = OpAccessChain %25 %19 %21 290 %34 = OpLoad %16 %33 291 -%35 = OpISub %16 %34 %31 292 +%51 = OpIAdd %16 %34 %31 293 -OpStore %33 %35 294 +OpStore %33 %51 295 OpReturn 296 OpFunctionEnd 297 %12 = OpFunction %2 None %3 298 %13 = OpLabel 299 %37 = OpAccessChain %25 %19 %21 300 %38 = OpLoad %16 %37 301 -%39 = OpIMul %16 %38 %36 302 +%52 = OpISub %16 %38 %36 303 %40 = OpAccessChain %25 %19 %21 304 -OpStore %40 %39 305 +OpStore %40 %52 306 OpReturn 307 OpFunctionEnd 308 %14 = OpFunction %2 None %3 309 %15 = OpLabel 310 %41 = OpAccessChain %25 %19 %21 311 %42 = OpLoad %16 %41 312 -%43 = OpUDiv %16 %42 %36 313 +%53 = OpIAdd %16 %42 %36 314 %44 = OpAccessChain %25 %19 %21 315 -OpStore %44 %43 316 +OpStore %44 %53 317 OpReturn 318 OpFunctionEnd 319 )"; 320 Options options; 321 DoStringDiffTest(kSrc, kDst, kDiff, options); 322 } 323 324 TEST(DiffTest, SmallFunctionsSmallDiffsNoDebug) { 325 constexpr char kSrcNoDebug[] = R"( OpCapability Shader 326 %1 = OpExtInstImport "GLSL.std.450" 327 OpMemoryModel Logical GLSL450 328 OpEntryPoint GLCompute %4 "main" 329 OpExecutionMode %4 LocalSize 1 1 1 330 OpSource ESSL 310 331 OpMemberDecorate %17 0 Offset 0 332 OpDecorate %17 BufferBlock 333 OpDecorate %19 DescriptorSet 0 334 OpDecorate %19 Binding 1 335 OpMemberDecorate %22 0 Offset 0 336 OpDecorate %22 Block 337 OpDecorate %24 DescriptorSet 0 338 OpDecorate %24 Binding 0 339 %2 = OpTypeVoid 340 %3 = OpTypeFunction %2 341 %16 = OpTypeInt 32 0 342 %17 = OpTypeStruct %16 343 %18 = OpTypePointer Uniform %17 344 %19 = OpVariable %18 Uniform 345 %20 = OpTypeInt 32 1 346 %21 = OpConstant %20 0 347 %22 = OpTypeStruct %16 348 %23 = OpTypePointer Uniform %22 349 %24 = OpVariable %23 Uniform 350 %25 = OpTypePointer Uniform %16 351 %31 = OpConstant %20 1 352 %36 = OpConstant %16 2 353 %4 = OpFunction %2 None %3 354 %5 = OpLabel 355 %45 = OpFunctionCall %2 %6 356 %46 = OpFunctionCall %2 %8 357 %47 = OpFunctionCall %2 %10 358 %48 = OpFunctionCall %2 %12 359 %49 = OpFunctionCall %2 %14 360 OpReturn 361 OpFunctionEnd 362 %6 = OpFunction %2 None %3 363 %7 = OpLabel 364 %26 = OpAccessChain %25 %24 %21 365 %27 = OpLoad %16 %26 366 %28 = OpAccessChain %25 %19 %21 367 OpStore %28 %27 368 OpReturn 369 OpFunctionEnd 370 %8 = OpFunction %2 None %3 371 %9 = OpLabel 372 %29 = OpAccessChain %25 %19 %21 373 %30 = OpLoad %16 %29 374 %32 = OpIAdd %16 %30 %31 375 OpStore %29 %32 376 OpReturn 377 OpFunctionEnd 378 %10 = OpFunction %2 None %3 379 %11 = OpLabel 380 %33 = OpAccessChain %25 %19 %21 381 %34 = OpLoad %16 %33 382 %35 = OpISub %16 %34 %31 383 OpStore %33 %35 384 OpReturn 385 OpFunctionEnd 386 %12 = OpFunction %2 None %3 387 %13 = OpLabel 388 %37 = OpAccessChain %25 %19 %21 389 %38 = OpLoad %16 %37 390 %39 = OpIMul %16 %38 %36 391 %40 = OpAccessChain %25 %19 %21 392 OpStore %40 %39 393 OpReturn 394 OpFunctionEnd 395 %14 = OpFunction %2 None %3 396 %15 = OpLabel 397 %41 = OpAccessChain %25 %19 %21 398 %42 = OpLoad %16 %41 399 %43 = OpUDiv %16 %42 %36 400 %44 = OpAccessChain %25 %19 %21 401 OpStore %44 %43 402 OpReturn 403 OpFunctionEnd 404 405 )"; 406 constexpr char kDstNoDebug[] = R"( OpCapability Shader 407 %1 = OpExtInstImport "GLSL.std.450" 408 OpMemoryModel Logical GLSL450 409 OpEntryPoint GLCompute %4 "main" 410 OpExecutionMode %4 LocalSize 1 1 1 411 OpSource ESSL 310 412 OpMemberDecorate %17 0 Offset 0 413 OpDecorate %17 BufferBlock 414 OpDecorate %19 DescriptorSet 0 415 OpDecorate %19 Binding 1 416 OpMemberDecorate %22 0 Offset 0 417 OpDecorate %22 Block 418 OpDecorate %24 DescriptorSet 0 419 OpDecorate %24 Binding 0 420 %2 = OpTypeVoid 421 %3 = OpTypeFunction %2 422 %16 = OpTypeInt 32 0 423 %17 = OpTypeStruct %16 424 %18 = OpTypePointer Uniform %17 425 %19 = OpVariable %18 Uniform 426 %20 = OpTypeInt 32 1 427 %21 = OpConstant %20 0 428 %22 = OpTypeStruct %16 429 %23 = OpTypePointer Uniform %22 430 %24 = OpVariable %23 Uniform 431 %25 = OpTypePointer Uniform %16 432 %31 = OpConstant %20 1 433 %36 = OpConstant %16 2 434 %6 = OpFunction %2 None %3 435 %7 = OpLabel 436 %26 = OpAccessChain %25 %24 %21 437 %27 = OpLoad %16 %26 438 %28 = OpAccessChain %25 %19 %21 439 OpStore %28 %27 440 OpReturn 441 OpFunctionEnd 442 %14 = OpFunction %2 None %3 443 %15 = OpLabel 444 %41 = OpAccessChain %25 %19 %21 445 %42 = OpLoad %16 %41 446 %43 = OpIAdd %16 %42 %36 447 %44 = OpAccessChain %25 %19 %21 448 OpStore %44 %43 449 OpReturn 450 OpFunctionEnd 451 %8 = OpFunction %2 None %3 452 %9 = OpLabel 453 %29 = OpAccessChain %25 %19 %21 454 %30 = OpLoad %16 %29 455 %32 = OpISub %16 %30 %31 456 OpStore %29 %32 457 OpReturn 458 OpFunctionEnd 459 %10 = OpFunction %2 None %3 460 %11 = OpLabel 461 %33 = OpAccessChain %25 %19 %21 462 %34 = OpLoad %16 %33 463 %35 = OpIAdd %16 %34 %31 464 OpStore %33 %35 465 OpReturn 466 OpFunctionEnd 467 %4 = OpFunction %2 None %3 468 %5 = OpLabel 469 %45 = OpFunctionCall %2 %6 470 %46 = OpFunctionCall %2 %8 471 %47 = OpFunctionCall %2 %10 472 %48 = OpFunctionCall %2 %12 473 %49 = OpFunctionCall %2 %14 474 OpReturn 475 OpFunctionEnd 476 %12 = OpFunction %2 None %3 477 %13 = OpLabel 478 %37 = OpAccessChain %25 %19 %21 479 %38 = OpLoad %16 %37 480 %39 = OpISub %16 %38 %36 481 %40 = OpAccessChain %25 %19 %21 482 OpStore %40 %39 483 OpReturn 484 OpFunctionEnd 485 486 )"; 487 constexpr char kDiff[] = R"( ; SPIR-V 488 ; Version: 1.6 489 ; Generator: Khronos SPIR-V Tools Assembler; 0 490 -; Bound: 50 491 +; Bound: 52 492 ; Schema: 0 493 OpCapability Shader 494 %1 = OpExtInstImport "GLSL.std.450" 495 OpMemoryModel Logical GLSL450 496 OpEntryPoint GLCompute %4 "main" 497 OpExecutionMode %4 LocalSize 1 1 1 498 OpSource ESSL 310 499 OpMemberDecorate %17 0 Offset 0 500 OpDecorate %17 BufferBlock 501 OpDecorate %19 DescriptorSet 0 502 OpDecorate %19 Binding 1 503 OpMemberDecorate %22 0 Offset 0 504 OpDecorate %22 Block 505 OpDecorate %24 DescriptorSet 0 506 OpDecorate %24 Binding 0 507 %2 = OpTypeVoid 508 %3 = OpTypeFunction %2 509 %16 = OpTypeInt 32 0 510 %17 = OpTypeStruct %16 511 %18 = OpTypePointer Uniform %17 512 %19 = OpVariable %18 Uniform 513 %20 = OpTypeInt 32 1 514 %21 = OpConstant %20 0 515 %22 = OpTypeStruct %16 516 %23 = OpTypePointer Uniform %22 517 %24 = OpVariable %23 Uniform 518 %25 = OpTypePointer Uniform %16 519 %31 = OpConstant %20 1 520 %36 = OpConstant %16 2 521 %4 = OpFunction %2 None %3 522 %5 = OpLabel 523 %45 = OpFunctionCall %2 %6 524 -%46 = OpFunctionCall %2 %8 525 +%46 = OpFunctionCall %2 %10 526 -%47 = OpFunctionCall %2 %10 527 +%47 = OpFunctionCall %2 %8 528 %48 = OpFunctionCall %2 %12 529 %49 = OpFunctionCall %2 %14 530 OpReturn 531 OpFunctionEnd 532 %6 = OpFunction %2 None %3 533 %7 = OpLabel 534 %26 = OpAccessChain %25 %24 %21 535 %27 = OpLoad %16 %26 536 %28 = OpAccessChain %25 %19 %21 537 OpStore %28 %27 538 OpReturn 539 OpFunctionEnd 540 %8 = OpFunction %2 None %3 541 %9 = OpLabel 542 %29 = OpAccessChain %25 %19 %21 543 %30 = OpLoad %16 %29 544 %32 = OpIAdd %16 %30 %31 545 OpStore %29 %32 546 OpReturn 547 OpFunctionEnd 548 %10 = OpFunction %2 None %3 549 %11 = OpLabel 550 %33 = OpAccessChain %25 %19 %21 551 %34 = OpLoad %16 %33 552 %35 = OpISub %16 %34 %31 553 OpStore %33 %35 554 OpReturn 555 OpFunctionEnd 556 %12 = OpFunction %2 None %3 557 %13 = OpLabel 558 %37 = OpAccessChain %25 %19 %21 559 %38 = OpLoad %16 %37 560 -%39 = OpIMul %16 %38 %36 561 +%50 = OpISub %16 %38 %36 562 %40 = OpAccessChain %25 %19 %21 563 -OpStore %40 %39 564 +OpStore %40 %50 565 OpReturn 566 OpFunctionEnd 567 %14 = OpFunction %2 None %3 568 %15 = OpLabel 569 %41 = OpAccessChain %25 %19 %21 570 %42 = OpLoad %16 %41 571 -%43 = OpUDiv %16 %42 %36 572 +%51 = OpIAdd %16 %42 %36 573 %44 = OpAccessChain %25 %19 %21 574 -OpStore %44 %43 575 +OpStore %44 %51 576 OpReturn 577 OpFunctionEnd 578 )"; 579 Options options; 580 DoStringDiffTest(kSrcNoDebug, kDstNoDebug, kDiff, options); 581 } 582 583 TEST(DiffTest, SmallFunctionsSmallDiffsDumpIds) { 584 constexpr char kDiff[] = R"( ; SPIR-V 585 ; Version: 1.6 586 ; Generator: Khronos SPIR-V Tools Assembler; 0 587 -; Bound: 50 588 +; Bound: 54 589 ; Schema: 0 590 OpCapability Shader 591 %1 = OpExtInstImport "GLSL.std.450" 592 OpMemoryModel Logical GLSL450 593 OpEntryPoint GLCompute %4 "main" 594 OpExecutionMode %4 LocalSize 1 1 1 595 OpSource ESSL 310 596 OpName %4 "main" 597 OpName %6 "f1(" 598 OpName %8 "f2(" 599 OpName %10 "f3(" 600 OpName %12 "f4(" 601 OpName %14 "f5(" 602 OpName %17 "BufferOut" 603 OpMemberName %17 0 "o" 604 OpName %19 "" 605 OpName %22 "BufferIn" 606 OpMemberName %22 0 "i" 607 OpName %24 "" 608 OpMemberDecorate %17 0 Offset 0 609 OpDecorate %17 BufferBlock 610 OpDecorate %19 DescriptorSet 0 611 OpDecorate %19 Binding 1 612 OpMemberDecorate %22 0 Offset 0 613 OpDecorate %22 Block 614 OpDecorate %24 DescriptorSet 0 615 OpDecorate %24 Binding 0 616 %2 = OpTypeVoid 617 %3 = OpTypeFunction %2 618 %16 = OpTypeInt 32 0 619 %17 = OpTypeStruct %16 620 %18 = OpTypePointer Uniform %17 621 %19 = OpVariable %18 Uniform 622 %20 = OpTypeInt 32 1 623 %21 = OpConstant %20 0 624 %22 = OpTypeStruct %16 625 %23 = OpTypePointer Uniform %22 626 %24 = OpVariable %23 Uniform 627 %25 = OpTypePointer Uniform %16 628 %31 = OpConstant %20 1 629 %36 = OpConstant %16 2 630 %4 = OpFunction %2 None %3 631 %5 = OpLabel 632 %45 = OpFunctionCall %2 %6 633 %46 = OpFunctionCall %2 %8 634 %47 = OpFunctionCall %2 %10 635 %48 = OpFunctionCall %2 %12 636 %49 = OpFunctionCall %2 %14 637 OpReturn 638 OpFunctionEnd 639 %6 = OpFunction %2 None %3 640 %7 = OpLabel 641 %26 = OpAccessChain %25 %24 %21 642 %27 = OpLoad %16 %26 643 %28 = OpAccessChain %25 %19 %21 644 OpStore %28 %27 645 OpReturn 646 OpFunctionEnd 647 %8 = OpFunction %2 None %3 648 %9 = OpLabel 649 %29 = OpAccessChain %25 %19 %21 650 %30 = OpLoad %16 %29 651 -%32 = OpIAdd %16 %30 %31 652 +%50 = OpISub %16 %30 %31 653 -OpStore %29 %32 654 +OpStore %29 %50 655 OpReturn 656 OpFunctionEnd 657 %10 = OpFunction %2 None %3 658 %11 = OpLabel 659 %33 = OpAccessChain %25 %19 %21 660 %34 = OpLoad %16 %33 661 -%35 = OpISub %16 %34 %31 662 +%51 = OpIAdd %16 %34 %31 663 -OpStore %33 %35 664 +OpStore %33 %51 665 OpReturn 666 OpFunctionEnd 667 %12 = OpFunction %2 None %3 668 %13 = OpLabel 669 %37 = OpAccessChain %25 %19 %21 670 %38 = OpLoad %16 %37 671 -%39 = OpIMul %16 %38 %36 672 +%52 = OpISub %16 %38 %36 673 %40 = OpAccessChain %25 %19 %21 674 -OpStore %40 %39 675 +OpStore %40 %52 676 OpReturn 677 OpFunctionEnd 678 %14 = OpFunction %2 None %3 679 %15 = OpLabel 680 %41 = OpAccessChain %25 %19 %21 681 %42 = OpLoad %16 %41 682 -%43 = OpUDiv %16 %42 %36 683 +%53 = OpIAdd %16 %42 %36 684 %44 = OpAccessChain %25 %19 %21 685 -OpStore %44 %43 686 +OpStore %44 %53 687 OpReturn 688 OpFunctionEnd 689 Src -> Dst 690 1 -> 1 [ExtInstImport] 691 2 -> 2 [TypeVoid] 692 3 -> 3 [TypeFunction] 693 4 -> 4 [Function] 694 5 -> 5 [Label] 695 6 -> 6 [Function] 696 7 -> 7 [Label] 697 8 -> 8 [Function] 698 9 -> 9 [Label] 699 10 -> 10 [Function] 700 11 -> 11 [Label] 701 12 -> 12 [Function] 702 13 -> 13 [Label] 703 14 -> 14 [Function] 704 15 -> 15 [Label] 705 16 -> 16 [TypeInt] 706 17 -> 17 [TypeStruct] 707 18 -> 18 [TypePointer] 708 19 -> 19 [Variable] 709 20 -> 20 [TypeInt] 710 21 -> 21 [Constant] 711 22 -> 22 [TypeStruct] 712 23 -> 23 [TypePointer] 713 24 -> 24 [Variable] 714 25 -> 25 [TypePointer] 715 26 -> 26 [AccessChain] 716 27 -> 27 [Load] 717 28 -> 28 [AccessChain] 718 29 -> 29 [AccessChain] 719 30 -> 30 [Load] 720 31 -> 31 [Constant] 721 32 -> 50 [IAdd] 722 33 -> 33 [AccessChain] 723 34 -> 34 [Load] 724 35 -> 51 [ISub] 725 36 -> 36 [Constant] 726 37 -> 37 [AccessChain] 727 38 -> 38 [Load] 728 39 -> 52 [IMul] 729 40 -> 40 [AccessChain] 730 41 -> 41 [AccessChain] 731 42 -> 42 [Load] 732 43 -> 53 [UDiv] 733 44 -> 44 [AccessChain] 734 45 -> 45 [FunctionCall] 735 46 -> 46 [FunctionCall] 736 47 -> 47 [FunctionCall] 737 48 -> 48 [FunctionCall] 738 49 -> 49 [FunctionCall] 739 )"; 740 Options options; 741 options.dump_id_map = true; 742 DoStringDiffTest(kSrc, kDst, kDiff, options); 743 } 744 745 } // namespace 746 } // namespace diff 747 } // namespace spvtools 748