1fd4e5da5Sopenharmony_ci// Copyright (c) 2019 Google LLC 2fd4e5da5Sopenharmony_ci// 3fd4e5da5Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License"); 4fd4e5da5Sopenharmony_ci// you may not use this file except in compliance with the License. 5fd4e5da5Sopenharmony_ci// You may obtain a copy of the License at 6fd4e5da5Sopenharmony_ci// 7fd4e5da5Sopenharmony_ci// http://www.apache.org/licenses/LICENSE-2.0 8fd4e5da5Sopenharmony_ci// 9fd4e5da5Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software 10fd4e5da5Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS, 11fd4e5da5Sopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12fd4e5da5Sopenharmony_ci// See the License for the specific language governing permissions and 13fd4e5da5Sopenharmony_ci// limitations under the License. 14fd4e5da5Sopenharmony_ci 15fd4e5da5Sopenharmony_ci#include "test/opt/assembly_builder.h" 16fd4e5da5Sopenharmony_ci#include "test/opt/pass_fixture.h" 17fd4e5da5Sopenharmony_ci#include "test/opt/pass_utils.h" 18fd4e5da5Sopenharmony_ci 19fd4e5da5Sopenharmony_cinamespace spvtools { 20fd4e5da5Sopenharmony_cinamespace opt { 21fd4e5da5Sopenharmony_cinamespace { 22fd4e5da5Sopenharmony_ci 23fd4e5da5Sopenharmony_ciusing WrapOpKillTest = PassTest<::testing::Test>; 24fd4e5da5Sopenharmony_ci 25fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, SingleOpKill) { 26fd4e5da5Sopenharmony_ci const std::string text = R"( 27fd4e5da5Sopenharmony_ci; CHECK: OpEntryPoint Fragment [[main:%\w+]] 28fd4e5da5Sopenharmony_ci; CHECK: [[main]] = OpFunction 29fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %void [[orig_kill:%\w+]] 30fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill]] = OpFunction 31fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 32fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill:%\w+]] 33fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 34fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 35fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 36fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpKill 37fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 38fd4e5da5Sopenharmony_ci OpCapability Shader 39fd4e5da5Sopenharmony_ci %1 = OpExtInstImport "GLSL.std.450" 40fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 41fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %main "main" 42fd4e5da5Sopenharmony_ci OpExecutionMode %main OriginUpperLeft 43fd4e5da5Sopenharmony_ci OpSource GLSL 330 44fd4e5da5Sopenharmony_ci OpName %main "main" 45fd4e5da5Sopenharmony_ci %void = OpTypeVoid 46fd4e5da5Sopenharmony_ci %5 = OpTypeFunction %void 47fd4e5da5Sopenharmony_ci %bool = OpTypeBool 48fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 49fd4e5da5Sopenharmony_ci %main = OpFunction %void None %5 50fd4e5da5Sopenharmony_ci %8 = OpLabel 51fd4e5da5Sopenharmony_ci OpBranch %9 52fd4e5da5Sopenharmony_ci %9 = OpLabel 53fd4e5da5Sopenharmony_ci OpLoopMerge %10 %11 None 54fd4e5da5Sopenharmony_ci OpBranch %12 55fd4e5da5Sopenharmony_ci %12 = OpLabel 56fd4e5da5Sopenharmony_ci OpBranchConditional %true %13 %10 57fd4e5da5Sopenharmony_ci %13 = OpLabel 58fd4e5da5Sopenharmony_ci OpBranch %11 59fd4e5da5Sopenharmony_ci %11 = OpLabel 60fd4e5da5Sopenharmony_ci %14 = OpFunctionCall %void %kill_ 61fd4e5da5Sopenharmony_ci OpBranch %9 62fd4e5da5Sopenharmony_ci %10 = OpLabel 63fd4e5da5Sopenharmony_ci OpReturn 64fd4e5da5Sopenharmony_ci OpFunctionEnd 65fd4e5da5Sopenharmony_ci %kill_ = OpFunction %void None %5 66fd4e5da5Sopenharmony_ci %15 = OpLabel 67fd4e5da5Sopenharmony_ci OpKill 68fd4e5da5Sopenharmony_ci OpFunctionEnd 69fd4e5da5Sopenharmony_ci )"; 70fd4e5da5Sopenharmony_ci 71fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 72fd4e5da5Sopenharmony_ci} 73fd4e5da5Sopenharmony_ci 74fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, MultipleOpKillInSameFunc) { 75fd4e5da5Sopenharmony_ci const std::string text = R"( 76fd4e5da5Sopenharmony_ci; CHECK: OpEntryPoint Fragment [[main:%\w+]] 77fd4e5da5Sopenharmony_ci; CHECK: [[main]] = OpFunction 78fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %void [[orig_kill:%\w+]] 79fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill]] = OpFunction 80fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 81fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpSelectionMerge 82fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpBranchConditional 83fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 84fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill:%\w+]] 85fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 86fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 87fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill]] 88fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 89fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 90fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 91fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpKill 92fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 93fd4e5da5Sopenharmony_ci OpCapability Shader 94fd4e5da5Sopenharmony_ci %1 = OpExtInstImport "GLSL.std.450" 95fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 96fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %main "main" 97fd4e5da5Sopenharmony_ci OpExecutionMode %main OriginUpperLeft 98fd4e5da5Sopenharmony_ci OpSource GLSL 330 99fd4e5da5Sopenharmony_ci OpName %main "main" 100fd4e5da5Sopenharmony_ci %void = OpTypeVoid 101fd4e5da5Sopenharmony_ci %5 = OpTypeFunction %void 102fd4e5da5Sopenharmony_ci %bool = OpTypeBool 103fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 104fd4e5da5Sopenharmony_ci %main = OpFunction %void None %5 105fd4e5da5Sopenharmony_ci %8 = OpLabel 106fd4e5da5Sopenharmony_ci OpBranch %9 107fd4e5da5Sopenharmony_ci %9 = OpLabel 108fd4e5da5Sopenharmony_ci OpLoopMerge %10 %11 None 109fd4e5da5Sopenharmony_ci OpBranch %12 110fd4e5da5Sopenharmony_ci %12 = OpLabel 111fd4e5da5Sopenharmony_ci OpBranchConditional %true %13 %10 112fd4e5da5Sopenharmony_ci %13 = OpLabel 113fd4e5da5Sopenharmony_ci OpBranch %11 114fd4e5da5Sopenharmony_ci %11 = OpLabel 115fd4e5da5Sopenharmony_ci %14 = OpFunctionCall %void %kill_ 116fd4e5da5Sopenharmony_ci OpBranch %9 117fd4e5da5Sopenharmony_ci %10 = OpLabel 118fd4e5da5Sopenharmony_ci OpReturn 119fd4e5da5Sopenharmony_ci OpFunctionEnd 120fd4e5da5Sopenharmony_ci %kill_ = OpFunction %void None %5 121fd4e5da5Sopenharmony_ci %15 = OpLabel 122fd4e5da5Sopenharmony_ci OpSelectionMerge %16 None 123fd4e5da5Sopenharmony_ci OpBranchConditional %true %17 %18 124fd4e5da5Sopenharmony_ci %17 = OpLabel 125fd4e5da5Sopenharmony_ci OpKill 126fd4e5da5Sopenharmony_ci %18 = OpLabel 127fd4e5da5Sopenharmony_ci OpKill 128fd4e5da5Sopenharmony_ci %16 = OpLabel 129fd4e5da5Sopenharmony_ci OpReturn 130fd4e5da5Sopenharmony_ci OpFunctionEnd 131fd4e5da5Sopenharmony_ci )"; 132fd4e5da5Sopenharmony_ci 133fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 134fd4e5da5Sopenharmony_ci} 135fd4e5da5Sopenharmony_ci 136fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, MultipleOpKillInDifferentFunc) { 137fd4e5da5Sopenharmony_ci const std::string text = R"( 138fd4e5da5Sopenharmony_ci; CHECK: OpEntryPoint Fragment [[main:%\w+]] 139fd4e5da5Sopenharmony_ci; CHECK: [[main]] = OpFunction 140fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %void [[orig_kill1:%\w+]] 141fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[orig_kill2:%\w+]] 142fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill1]] = OpFunction 143fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 144fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill:%\w+]] 145fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 146fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill2]] = OpFunction 147fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 148fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill]] 149fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 150fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 151fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 152fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpKill 153fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 154fd4e5da5Sopenharmony_ci OpCapability Shader 155fd4e5da5Sopenharmony_ci %1 = OpExtInstImport "GLSL.std.450" 156fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 157fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %main "main" 158fd4e5da5Sopenharmony_ci OpExecutionMode %main OriginUpperLeft 159fd4e5da5Sopenharmony_ci OpSource GLSL 330 160fd4e5da5Sopenharmony_ci OpName %main "main" 161fd4e5da5Sopenharmony_ci %void = OpTypeVoid 162fd4e5da5Sopenharmony_ci %4 = OpTypeFunction %void 163fd4e5da5Sopenharmony_ci %bool = OpTypeBool 164fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 165fd4e5da5Sopenharmony_ci %main = OpFunction %void None %4 166fd4e5da5Sopenharmony_ci %7 = OpLabel 167fd4e5da5Sopenharmony_ci OpBranch %8 168fd4e5da5Sopenharmony_ci %8 = OpLabel 169fd4e5da5Sopenharmony_ci OpLoopMerge %9 %10 None 170fd4e5da5Sopenharmony_ci OpBranch %11 171fd4e5da5Sopenharmony_ci %11 = OpLabel 172fd4e5da5Sopenharmony_ci OpBranchConditional %true %12 %9 173fd4e5da5Sopenharmony_ci %12 = OpLabel 174fd4e5da5Sopenharmony_ci OpBranch %10 175fd4e5da5Sopenharmony_ci %10 = OpLabel 176fd4e5da5Sopenharmony_ci %13 = OpFunctionCall %void %14 177fd4e5da5Sopenharmony_ci %15 = OpFunctionCall %void %16 178fd4e5da5Sopenharmony_ci OpBranch %8 179fd4e5da5Sopenharmony_ci %9 = OpLabel 180fd4e5da5Sopenharmony_ci OpReturn 181fd4e5da5Sopenharmony_ci OpFunctionEnd 182fd4e5da5Sopenharmony_ci %14 = OpFunction %void None %4 183fd4e5da5Sopenharmony_ci %17 = OpLabel 184fd4e5da5Sopenharmony_ci OpKill 185fd4e5da5Sopenharmony_ci OpFunctionEnd 186fd4e5da5Sopenharmony_ci %16 = OpFunction %void None %4 187fd4e5da5Sopenharmony_ci %18 = OpLabel 188fd4e5da5Sopenharmony_ci OpKill 189fd4e5da5Sopenharmony_ci OpFunctionEnd 190fd4e5da5Sopenharmony_ci )"; 191fd4e5da5Sopenharmony_ci 192fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 193fd4e5da5Sopenharmony_ci} 194fd4e5da5Sopenharmony_ci 195fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, SingleOpTerminateInvocation) { 196fd4e5da5Sopenharmony_ci const std::string text = R"( 197fd4e5da5Sopenharmony_ci; CHECK: OpEntryPoint Fragment [[main:%\w+]] 198fd4e5da5Sopenharmony_ci; CHECK: [[main]] = OpFunction 199fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %void [[orig_kill:%\w+]] 200fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill]] = OpFunction 201fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 202fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill:%\w+]] 203fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 204fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 205fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 206fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpTerminateInvocation 207fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 208fd4e5da5Sopenharmony_ci OpCapability Shader 209fd4e5da5Sopenharmony_ci OpExtension "SPV_KHR_terminate_invocation" 210fd4e5da5Sopenharmony_ci %1 = OpExtInstImport "GLSL.std.450" 211fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 212fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %main "main" 213fd4e5da5Sopenharmony_ci OpExecutionMode %main OriginUpperLeft 214fd4e5da5Sopenharmony_ci OpSource GLSL 330 215fd4e5da5Sopenharmony_ci OpName %main "main" 216fd4e5da5Sopenharmony_ci %void = OpTypeVoid 217fd4e5da5Sopenharmony_ci %5 = OpTypeFunction %void 218fd4e5da5Sopenharmony_ci %bool = OpTypeBool 219fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 220fd4e5da5Sopenharmony_ci %main = OpFunction %void None %5 221fd4e5da5Sopenharmony_ci %8 = OpLabel 222fd4e5da5Sopenharmony_ci OpBranch %9 223fd4e5da5Sopenharmony_ci %9 = OpLabel 224fd4e5da5Sopenharmony_ci OpLoopMerge %10 %11 None 225fd4e5da5Sopenharmony_ci OpBranch %12 226fd4e5da5Sopenharmony_ci %12 = OpLabel 227fd4e5da5Sopenharmony_ci OpBranchConditional %true %13 %10 228fd4e5da5Sopenharmony_ci %13 = OpLabel 229fd4e5da5Sopenharmony_ci OpBranch %11 230fd4e5da5Sopenharmony_ci %11 = OpLabel 231fd4e5da5Sopenharmony_ci %14 = OpFunctionCall %void %kill_ 232fd4e5da5Sopenharmony_ci OpBranch %9 233fd4e5da5Sopenharmony_ci %10 = OpLabel 234fd4e5da5Sopenharmony_ci OpReturn 235fd4e5da5Sopenharmony_ci OpFunctionEnd 236fd4e5da5Sopenharmony_ci %kill_ = OpFunction %void None %5 237fd4e5da5Sopenharmony_ci %15 = OpLabel 238fd4e5da5Sopenharmony_ci OpTerminateInvocation 239fd4e5da5Sopenharmony_ci OpFunctionEnd 240fd4e5da5Sopenharmony_ci )"; 241fd4e5da5Sopenharmony_ci 242fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 243fd4e5da5Sopenharmony_ci} 244fd4e5da5Sopenharmony_ci 245fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, MultipleTerminateInvocationInSameFunc) { 246fd4e5da5Sopenharmony_ci const std::string text = R"( 247fd4e5da5Sopenharmony_ci; CHECK: OpEntryPoint Fragment [[main:%\w+]] 248fd4e5da5Sopenharmony_ci; CHECK: [[main]] = OpFunction 249fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %void [[orig_kill:%\w+]] 250fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill]] = OpFunction 251fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 252fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpSelectionMerge 253fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpBranchConditional 254fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 255fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill:%\w+]] 256fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 257fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 258fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill]] 259fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 260fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 261fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 262fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpTerminateInvocation 263fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 264fd4e5da5Sopenharmony_ci OpCapability Shader 265fd4e5da5Sopenharmony_ci OpExtension "SPV_KHR_terminate_invocation" 266fd4e5da5Sopenharmony_ci %1 = OpExtInstImport "GLSL.std.450" 267fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 268fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %main "main" 269fd4e5da5Sopenharmony_ci OpExecutionMode %main OriginUpperLeft 270fd4e5da5Sopenharmony_ci OpSource GLSL 330 271fd4e5da5Sopenharmony_ci OpName %main "main" 272fd4e5da5Sopenharmony_ci %void = OpTypeVoid 273fd4e5da5Sopenharmony_ci %5 = OpTypeFunction %void 274fd4e5da5Sopenharmony_ci %bool = OpTypeBool 275fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 276fd4e5da5Sopenharmony_ci %main = OpFunction %void None %5 277fd4e5da5Sopenharmony_ci %8 = OpLabel 278fd4e5da5Sopenharmony_ci OpBranch %9 279fd4e5da5Sopenharmony_ci %9 = OpLabel 280fd4e5da5Sopenharmony_ci OpLoopMerge %10 %11 None 281fd4e5da5Sopenharmony_ci OpBranch %12 282fd4e5da5Sopenharmony_ci %12 = OpLabel 283fd4e5da5Sopenharmony_ci OpBranchConditional %true %13 %10 284fd4e5da5Sopenharmony_ci %13 = OpLabel 285fd4e5da5Sopenharmony_ci OpBranch %11 286fd4e5da5Sopenharmony_ci %11 = OpLabel 287fd4e5da5Sopenharmony_ci %14 = OpFunctionCall %void %kill_ 288fd4e5da5Sopenharmony_ci OpBranch %9 289fd4e5da5Sopenharmony_ci %10 = OpLabel 290fd4e5da5Sopenharmony_ci OpReturn 291fd4e5da5Sopenharmony_ci OpFunctionEnd 292fd4e5da5Sopenharmony_ci %kill_ = OpFunction %void None %5 293fd4e5da5Sopenharmony_ci %15 = OpLabel 294fd4e5da5Sopenharmony_ci OpSelectionMerge %16 None 295fd4e5da5Sopenharmony_ci OpBranchConditional %true %17 %18 296fd4e5da5Sopenharmony_ci %17 = OpLabel 297fd4e5da5Sopenharmony_ci OpTerminateInvocation 298fd4e5da5Sopenharmony_ci %18 = OpLabel 299fd4e5da5Sopenharmony_ci OpTerminateInvocation 300fd4e5da5Sopenharmony_ci %16 = OpLabel 301fd4e5da5Sopenharmony_ci OpReturn 302fd4e5da5Sopenharmony_ci OpFunctionEnd 303fd4e5da5Sopenharmony_ci )"; 304fd4e5da5Sopenharmony_ci 305fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 306fd4e5da5Sopenharmony_ci} 307fd4e5da5Sopenharmony_ci 308fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, MultipleOpTerminateInvocationDifferentFunc) { 309fd4e5da5Sopenharmony_ci const std::string text = R"( 310fd4e5da5Sopenharmony_ci; CHECK: OpEntryPoint Fragment [[main:%\w+]] 311fd4e5da5Sopenharmony_ci; CHECK: [[main]] = OpFunction 312fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %void [[orig_kill1:%\w+]] 313fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[orig_kill2:%\w+]] 314fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill1]] = OpFunction 315fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 316fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill:%\w+]] 317fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 318fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill2]] = OpFunction 319fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 320fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill]] 321fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 322fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 323fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 324fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpTerminateInvocation 325fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 326fd4e5da5Sopenharmony_ci OpCapability Shader 327fd4e5da5Sopenharmony_ci OpExtension "SPV_KHR_terminate_invocation" 328fd4e5da5Sopenharmony_ci %1 = OpExtInstImport "GLSL.std.450" 329fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 330fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %main "main" 331fd4e5da5Sopenharmony_ci OpExecutionMode %main OriginUpperLeft 332fd4e5da5Sopenharmony_ci OpSource GLSL 330 333fd4e5da5Sopenharmony_ci OpName %main "main" 334fd4e5da5Sopenharmony_ci %void = OpTypeVoid 335fd4e5da5Sopenharmony_ci %4 = OpTypeFunction %void 336fd4e5da5Sopenharmony_ci %bool = OpTypeBool 337fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 338fd4e5da5Sopenharmony_ci %main = OpFunction %void None %4 339fd4e5da5Sopenharmony_ci %7 = OpLabel 340fd4e5da5Sopenharmony_ci OpBranch %8 341fd4e5da5Sopenharmony_ci %8 = OpLabel 342fd4e5da5Sopenharmony_ci OpLoopMerge %9 %10 None 343fd4e5da5Sopenharmony_ci OpBranch %11 344fd4e5da5Sopenharmony_ci %11 = OpLabel 345fd4e5da5Sopenharmony_ci OpBranchConditional %true %12 %9 346fd4e5da5Sopenharmony_ci %12 = OpLabel 347fd4e5da5Sopenharmony_ci OpBranch %10 348fd4e5da5Sopenharmony_ci %10 = OpLabel 349fd4e5da5Sopenharmony_ci %13 = OpFunctionCall %void %14 350fd4e5da5Sopenharmony_ci %15 = OpFunctionCall %void %16 351fd4e5da5Sopenharmony_ci OpBranch %8 352fd4e5da5Sopenharmony_ci %9 = OpLabel 353fd4e5da5Sopenharmony_ci OpReturn 354fd4e5da5Sopenharmony_ci OpFunctionEnd 355fd4e5da5Sopenharmony_ci %14 = OpFunction %void None %4 356fd4e5da5Sopenharmony_ci %17 = OpLabel 357fd4e5da5Sopenharmony_ci OpTerminateInvocation 358fd4e5da5Sopenharmony_ci OpFunctionEnd 359fd4e5da5Sopenharmony_ci %16 = OpFunction %void None %4 360fd4e5da5Sopenharmony_ci %18 = OpLabel 361fd4e5da5Sopenharmony_ci OpTerminateInvocation 362fd4e5da5Sopenharmony_ci OpFunctionEnd 363fd4e5da5Sopenharmony_ci )"; 364fd4e5da5Sopenharmony_ci 365fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 366fd4e5da5Sopenharmony_ci} 367fd4e5da5Sopenharmony_ci 368fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, KillAndTerminateInvocationSameFunc) { 369fd4e5da5Sopenharmony_ci const std::string text = R"( 370fd4e5da5Sopenharmony_ci; CHECK: OpEntryPoint Fragment [[main:%\w+]] 371fd4e5da5Sopenharmony_ci; CHECK: [[main]] = OpFunction 372fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %void [[orig_kill:%\w+]] 373fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill]] = OpFunction 374fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 375fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpSelectionMerge 376fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpBranchConditional 377fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 378fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill:%\w+]] 379fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 380fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 381fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_terminate:%\w+]] 382fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 383fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 384fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 385fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpKill 386fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 387fd4e5da5Sopenharmony_ci; CHECK-NEXT: [[new_terminate]] = OpFunction 388fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 389fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpTerminateInvocation 390fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 391fd4e5da5Sopenharmony_ci OpCapability Shader 392fd4e5da5Sopenharmony_ci OpExtension "SPV_KHR_terminate_invocation" 393fd4e5da5Sopenharmony_ci %1 = OpExtInstImport "GLSL.std.450" 394fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 395fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %main "main" 396fd4e5da5Sopenharmony_ci OpExecutionMode %main OriginUpperLeft 397fd4e5da5Sopenharmony_ci OpSource GLSL 330 398fd4e5da5Sopenharmony_ci OpName %main "main" 399fd4e5da5Sopenharmony_ci %void = OpTypeVoid 400fd4e5da5Sopenharmony_ci %5 = OpTypeFunction %void 401fd4e5da5Sopenharmony_ci %bool = OpTypeBool 402fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 403fd4e5da5Sopenharmony_ci %main = OpFunction %void None %5 404fd4e5da5Sopenharmony_ci %8 = OpLabel 405fd4e5da5Sopenharmony_ci OpBranch %9 406fd4e5da5Sopenharmony_ci %9 = OpLabel 407fd4e5da5Sopenharmony_ci OpLoopMerge %10 %11 None 408fd4e5da5Sopenharmony_ci OpBranch %12 409fd4e5da5Sopenharmony_ci %12 = OpLabel 410fd4e5da5Sopenharmony_ci OpBranchConditional %true %13 %10 411fd4e5da5Sopenharmony_ci %13 = OpLabel 412fd4e5da5Sopenharmony_ci OpBranch %11 413fd4e5da5Sopenharmony_ci %11 = OpLabel 414fd4e5da5Sopenharmony_ci %14 = OpFunctionCall %void %kill_ 415fd4e5da5Sopenharmony_ci OpBranch %9 416fd4e5da5Sopenharmony_ci %10 = OpLabel 417fd4e5da5Sopenharmony_ci OpReturn 418fd4e5da5Sopenharmony_ci OpFunctionEnd 419fd4e5da5Sopenharmony_ci %kill_ = OpFunction %void None %5 420fd4e5da5Sopenharmony_ci %15 = OpLabel 421fd4e5da5Sopenharmony_ci OpSelectionMerge %16 None 422fd4e5da5Sopenharmony_ci OpBranchConditional %true %17 %18 423fd4e5da5Sopenharmony_ci %17 = OpLabel 424fd4e5da5Sopenharmony_ci OpKill 425fd4e5da5Sopenharmony_ci %18 = OpLabel 426fd4e5da5Sopenharmony_ci OpTerminateInvocation 427fd4e5da5Sopenharmony_ci %16 = OpLabel 428fd4e5da5Sopenharmony_ci OpReturn 429fd4e5da5Sopenharmony_ci OpFunctionEnd 430fd4e5da5Sopenharmony_ci )"; 431fd4e5da5Sopenharmony_ci 432fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 433fd4e5da5Sopenharmony_ci} 434fd4e5da5Sopenharmony_ci 435fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, KillAndTerminateInvocationDifferentFunc) { 436fd4e5da5Sopenharmony_ci const std::string text = R"( 437fd4e5da5Sopenharmony_ci; CHECK: OpEntryPoint Fragment [[main:%\w+]] 438fd4e5da5Sopenharmony_ci; CHECK: [[main]] = OpFunction 439fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %void [[orig_kill1:%\w+]] 440fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[orig_kill2:%\w+]] 441fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill1]] = OpFunction 442fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 443fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_terminate:%\w+]] 444fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 445fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill2]] = OpFunction 446fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 447fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill:%\w+]] 448fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 449fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 450fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 451fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpKill 452fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 453fd4e5da5Sopenharmony_ci; CHECK-NEXT: [[new_terminate]] = OpFunction 454fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 455fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpTerminateInvocation 456fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 457fd4e5da5Sopenharmony_ci OpCapability Shader 458fd4e5da5Sopenharmony_ci OpExtension "SPV_KHR_terminate_invocation" 459fd4e5da5Sopenharmony_ci %1 = OpExtInstImport "GLSL.std.450" 460fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 461fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %main "main" 462fd4e5da5Sopenharmony_ci OpExecutionMode %main OriginUpperLeft 463fd4e5da5Sopenharmony_ci OpSource GLSL 330 464fd4e5da5Sopenharmony_ci OpName %main "main" 465fd4e5da5Sopenharmony_ci %void = OpTypeVoid 466fd4e5da5Sopenharmony_ci %4 = OpTypeFunction %void 467fd4e5da5Sopenharmony_ci %bool = OpTypeBool 468fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 469fd4e5da5Sopenharmony_ci %main = OpFunction %void None %4 470fd4e5da5Sopenharmony_ci %7 = OpLabel 471fd4e5da5Sopenharmony_ci OpBranch %8 472fd4e5da5Sopenharmony_ci %8 = OpLabel 473fd4e5da5Sopenharmony_ci OpLoopMerge %9 %10 None 474fd4e5da5Sopenharmony_ci OpBranch %11 475fd4e5da5Sopenharmony_ci %11 = OpLabel 476fd4e5da5Sopenharmony_ci OpBranchConditional %true %12 %9 477fd4e5da5Sopenharmony_ci %12 = OpLabel 478fd4e5da5Sopenharmony_ci OpBranch %10 479fd4e5da5Sopenharmony_ci %10 = OpLabel 480fd4e5da5Sopenharmony_ci %13 = OpFunctionCall %void %14 481fd4e5da5Sopenharmony_ci %15 = OpFunctionCall %void %16 482fd4e5da5Sopenharmony_ci OpBranch %8 483fd4e5da5Sopenharmony_ci %9 = OpLabel 484fd4e5da5Sopenharmony_ci OpReturn 485fd4e5da5Sopenharmony_ci OpFunctionEnd 486fd4e5da5Sopenharmony_ci %14 = OpFunction %void None %4 487fd4e5da5Sopenharmony_ci %17 = OpLabel 488fd4e5da5Sopenharmony_ci OpTerminateInvocation 489fd4e5da5Sopenharmony_ci OpFunctionEnd 490fd4e5da5Sopenharmony_ci %16 = OpFunction %void None %4 491fd4e5da5Sopenharmony_ci %18 = OpLabel 492fd4e5da5Sopenharmony_ci OpKill 493fd4e5da5Sopenharmony_ci OpFunctionEnd 494fd4e5da5Sopenharmony_ci )"; 495fd4e5da5Sopenharmony_ci 496fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 497fd4e5da5Sopenharmony_ci} 498fd4e5da5Sopenharmony_ci 499fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, FuncWithReturnValue) { 500fd4e5da5Sopenharmony_ci const std::string text = R"( 501fd4e5da5Sopenharmony_ci; CHECK: OpEntryPoint Fragment [[main:%\w+]] 502fd4e5da5Sopenharmony_ci; CHECK: [[main]] = OpFunction 503fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %int [[orig_kill:%\w+]] 504fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill]] = OpFunction 505fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 506fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill:%\w+]] 507fd4e5da5Sopenharmony_ci; CHECK-NEXT: [[undef:%\w+]] = OpUndef %int 508fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturnValue [[undef]] 509fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 510fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 511fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpKill 512fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 513fd4e5da5Sopenharmony_ci OpCapability Shader 514fd4e5da5Sopenharmony_ci %1 = OpExtInstImport "GLSL.std.450" 515fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 516fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %main "main" 517fd4e5da5Sopenharmony_ci OpExecutionMode %main OriginUpperLeft 518fd4e5da5Sopenharmony_ci OpSource GLSL 330 519fd4e5da5Sopenharmony_ci OpName %main "main" 520fd4e5da5Sopenharmony_ci %void = OpTypeVoid 521fd4e5da5Sopenharmony_ci %5 = OpTypeFunction %void 522fd4e5da5Sopenharmony_ci %int = OpTypeInt 32 1 523fd4e5da5Sopenharmony_ci %func_type = OpTypeFunction %int 524fd4e5da5Sopenharmony_ci %bool = OpTypeBool 525fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 526fd4e5da5Sopenharmony_ci %main = OpFunction %void None %5 527fd4e5da5Sopenharmony_ci %8 = OpLabel 528fd4e5da5Sopenharmony_ci OpBranch %9 529fd4e5da5Sopenharmony_ci %9 = OpLabel 530fd4e5da5Sopenharmony_ci OpLoopMerge %10 %11 None 531fd4e5da5Sopenharmony_ci OpBranch %12 532fd4e5da5Sopenharmony_ci %12 = OpLabel 533fd4e5da5Sopenharmony_ci OpBranchConditional %true %13 %10 534fd4e5da5Sopenharmony_ci %13 = OpLabel 535fd4e5da5Sopenharmony_ci OpBranch %11 536fd4e5da5Sopenharmony_ci %11 = OpLabel 537fd4e5da5Sopenharmony_ci %14 = OpFunctionCall %int %kill_ 538fd4e5da5Sopenharmony_ci OpBranch %9 539fd4e5da5Sopenharmony_ci %10 = OpLabel 540fd4e5da5Sopenharmony_ci OpReturn 541fd4e5da5Sopenharmony_ci OpFunctionEnd 542fd4e5da5Sopenharmony_ci %kill_ = OpFunction %int None %func_type 543fd4e5da5Sopenharmony_ci %15 = OpLabel 544fd4e5da5Sopenharmony_ci OpKill 545fd4e5da5Sopenharmony_ci OpFunctionEnd 546fd4e5da5Sopenharmony_ci )"; 547fd4e5da5Sopenharmony_ci 548fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 549fd4e5da5Sopenharmony_ci} 550fd4e5da5Sopenharmony_ci 551fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, IdBoundOverflow1) { 552fd4e5da5Sopenharmony_ci const std::string text = R"( 553fd4e5da5Sopenharmony_ciOpCapability GeometryStreams 554fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450 555fd4e5da5Sopenharmony_ciOpEntryPoint Fragment %main "main" 556fd4e5da5Sopenharmony_ciOpExecutionMode %main OriginUpperLeft 557fd4e5da5Sopenharmony_ci%2 = OpTypeVoid 558fd4e5da5Sopenharmony_ci%3 = OpTypeFunction %2 559fd4e5da5Sopenharmony_ci%bool = OpTypeBool 560fd4e5da5Sopenharmony_ci%true = OpConstantTrue %bool 561fd4e5da5Sopenharmony_ci%main = OpFunction %2 None %3 562fd4e5da5Sopenharmony_ci%8 = OpLabel 563fd4e5da5Sopenharmony_ciOpBranch %9 564fd4e5da5Sopenharmony_ci%9 = OpLabel 565fd4e5da5Sopenharmony_ciOpLoopMerge %10 %11 None 566fd4e5da5Sopenharmony_ciOpBranch %12 567fd4e5da5Sopenharmony_ci%12 = OpLabel 568fd4e5da5Sopenharmony_ciOpBranchConditional %true %13 %10 569fd4e5da5Sopenharmony_ci%13 = OpLabel 570fd4e5da5Sopenharmony_ciOpBranch %11 571fd4e5da5Sopenharmony_ci%11 = OpLabel 572fd4e5da5Sopenharmony_ci%14 = OpFunctionCall %void %kill_ 573fd4e5da5Sopenharmony_ciOpBranch %9 574fd4e5da5Sopenharmony_ci%10 = OpLabel 575fd4e5da5Sopenharmony_ciOpReturn 576fd4e5da5Sopenharmony_ciOpFunctionEnd 577fd4e5da5Sopenharmony_ci%kill_ = OpFunction %2 Pure|Const %3 578fd4e5da5Sopenharmony_ci%4194302 = OpLabel 579fd4e5da5Sopenharmony_ciOpKill 580fd4e5da5Sopenharmony_ciOpFunctionEnd 581fd4e5da5Sopenharmony_ci)"; 582fd4e5da5Sopenharmony_ci 583fd4e5da5Sopenharmony_ci SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); 584fd4e5da5Sopenharmony_ci 585fd4e5da5Sopenharmony_ci std::vector<Message> messages = { 586fd4e5da5Sopenharmony_ci {SPV_MSG_ERROR, "", 0, 0, "ID overflow. Try running compact-ids."}}; 587fd4e5da5Sopenharmony_ci SetMessageConsumer(GetTestMessageConsumer(messages)); 588fd4e5da5Sopenharmony_ci auto result = SinglePassRunToBinary<WrapOpKill>(text, true); 589fd4e5da5Sopenharmony_ci EXPECT_EQ(Pass::Status::Failure, std::get<1>(result)); 590fd4e5da5Sopenharmony_ci} 591fd4e5da5Sopenharmony_ci 592fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, IdBoundOverflow2) { 593fd4e5da5Sopenharmony_ci const std::string text = R"( 594fd4e5da5Sopenharmony_ciOpCapability GeometryStreams 595fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450 596fd4e5da5Sopenharmony_ciOpEntryPoint Fragment %main "main" 597fd4e5da5Sopenharmony_ciOpExecutionMode %main OriginUpperLeft 598fd4e5da5Sopenharmony_ci%2 = OpTypeVoid 599fd4e5da5Sopenharmony_ci%3 = OpTypeFunction %2 600fd4e5da5Sopenharmony_ci%bool = OpTypeBool 601fd4e5da5Sopenharmony_ci%true = OpConstantTrue %bool 602fd4e5da5Sopenharmony_ci%main = OpFunction %2 None %3 603fd4e5da5Sopenharmony_ci%8 = OpLabel 604fd4e5da5Sopenharmony_ciOpBranch %9 605fd4e5da5Sopenharmony_ci%9 = OpLabel 606fd4e5da5Sopenharmony_ciOpLoopMerge %10 %11 None 607fd4e5da5Sopenharmony_ciOpBranch %12 608fd4e5da5Sopenharmony_ci%12 = OpLabel 609fd4e5da5Sopenharmony_ciOpBranchConditional %true %13 %10 610fd4e5da5Sopenharmony_ci%13 = OpLabel 611fd4e5da5Sopenharmony_ciOpBranch %11 612fd4e5da5Sopenharmony_ci%11 = OpLabel 613fd4e5da5Sopenharmony_ci%14 = OpFunctionCall %void %kill_ 614fd4e5da5Sopenharmony_ciOpBranch %9 615fd4e5da5Sopenharmony_ci%10 = OpLabel 616fd4e5da5Sopenharmony_ciOpReturn 617fd4e5da5Sopenharmony_ciOpFunctionEnd 618fd4e5da5Sopenharmony_ci%kill_ = OpFunction %2 Pure|Const %3 619fd4e5da5Sopenharmony_ci%4194301 = OpLabel 620fd4e5da5Sopenharmony_ciOpKill 621fd4e5da5Sopenharmony_ciOpFunctionEnd 622fd4e5da5Sopenharmony_ci)"; 623fd4e5da5Sopenharmony_ci 624fd4e5da5Sopenharmony_ci SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); 625fd4e5da5Sopenharmony_ci 626fd4e5da5Sopenharmony_ci std::vector<Message> messages = { 627fd4e5da5Sopenharmony_ci {SPV_MSG_ERROR, "", 0, 0, "ID overflow. Try running compact-ids."}}; 628fd4e5da5Sopenharmony_ci SetMessageConsumer(GetTestMessageConsumer(messages)); 629fd4e5da5Sopenharmony_ci auto result = SinglePassRunToBinary<WrapOpKill>(text, true); 630fd4e5da5Sopenharmony_ci EXPECT_EQ(Pass::Status::Failure, std::get<1>(result)); 631fd4e5da5Sopenharmony_ci} 632fd4e5da5Sopenharmony_ci 633fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, IdBoundOverflow3) { 634fd4e5da5Sopenharmony_ci const std::string text = R"( 635fd4e5da5Sopenharmony_ciOpCapability GeometryStreams 636fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450 637fd4e5da5Sopenharmony_ciOpEntryPoint Fragment %main "main" 638fd4e5da5Sopenharmony_ciOpExecutionMode %main OriginUpperLeft 639fd4e5da5Sopenharmony_ci%2 = OpTypeVoid 640fd4e5da5Sopenharmony_ci%3 = OpTypeFunction %2 641fd4e5da5Sopenharmony_ci%bool = OpTypeBool 642fd4e5da5Sopenharmony_ci%true = OpConstantTrue %bool 643fd4e5da5Sopenharmony_ci%main = OpFunction %2 None %3 644fd4e5da5Sopenharmony_ci%8 = OpLabel 645fd4e5da5Sopenharmony_ciOpBranch %9 646fd4e5da5Sopenharmony_ci%9 = OpLabel 647fd4e5da5Sopenharmony_ciOpLoopMerge %10 %11 None 648fd4e5da5Sopenharmony_ciOpBranch %12 649fd4e5da5Sopenharmony_ci%12 = OpLabel 650fd4e5da5Sopenharmony_ciOpBranchConditional %true %13 %10 651fd4e5da5Sopenharmony_ci%13 = OpLabel 652fd4e5da5Sopenharmony_ciOpBranch %11 653fd4e5da5Sopenharmony_ci%11 = OpLabel 654fd4e5da5Sopenharmony_ci%14 = OpFunctionCall %void %kill_ 655fd4e5da5Sopenharmony_ciOpBranch %9 656fd4e5da5Sopenharmony_ci%10 = OpLabel 657fd4e5da5Sopenharmony_ciOpReturn 658fd4e5da5Sopenharmony_ciOpFunctionEnd 659fd4e5da5Sopenharmony_ci%kill_ = OpFunction %2 Pure|Const %3 660fd4e5da5Sopenharmony_ci%4194300 = OpLabel 661fd4e5da5Sopenharmony_ciOpKill 662fd4e5da5Sopenharmony_ciOpFunctionEnd 663fd4e5da5Sopenharmony_ci)"; 664fd4e5da5Sopenharmony_ci 665fd4e5da5Sopenharmony_ci SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); 666fd4e5da5Sopenharmony_ci 667fd4e5da5Sopenharmony_ci std::vector<Message> messages = { 668fd4e5da5Sopenharmony_ci {SPV_MSG_ERROR, "", 0, 0, "ID overflow. Try running compact-ids."}}; 669fd4e5da5Sopenharmony_ci SetMessageConsumer(GetTestMessageConsumer(messages)); 670fd4e5da5Sopenharmony_ci auto result = SinglePassRunToBinary<WrapOpKill>(text, true); 671fd4e5da5Sopenharmony_ci EXPECT_EQ(Pass::Status::Failure, std::get<1>(result)); 672fd4e5da5Sopenharmony_ci} 673fd4e5da5Sopenharmony_ci 674fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, IdBoundOverflow4) { 675fd4e5da5Sopenharmony_ci const std::string text = R"( 676fd4e5da5Sopenharmony_ciOpCapability DerivativeControl 677fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450 678fd4e5da5Sopenharmony_ciOpEntryPoint Fragment %main "main" 679fd4e5da5Sopenharmony_ciOpExecutionMode %main OriginUpperLeft 680fd4e5da5Sopenharmony_ciOpDecorate %2 Location 539091968 681fd4e5da5Sopenharmony_ci%2 = OpTypeVoid 682fd4e5da5Sopenharmony_ci%3 = OpTypeFunction %2 683fd4e5da5Sopenharmony_ci%bool = OpTypeBool 684fd4e5da5Sopenharmony_ci%true = OpConstantTrue %bool 685fd4e5da5Sopenharmony_ci%main = OpFunction %2 None %3 686fd4e5da5Sopenharmony_ci%8 = OpLabel 687fd4e5da5Sopenharmony_ciOpBranch %9 688fd4e5da5Sopenharmony_ci%9 = OpLabel 689fd4e5da5Sopenharmony_ciOpLoopMerge %10 %11 None 690fd4e5da5Sopenharmony_ciOpBranch %12 691fd4e5da5Sopenharmony_ci%12 = OpLabel 692fd4e5da5Sopenharmony_ciOpBranchConditional %true %13 %10 693fd4e5da5Sopenharmony_ci%13 = OpLabel 694fd4e5da5Sopenharmony_ciOpBranch %11 695fd4e5da5Sopenharmony_ci%11 = OpLabel 696fd4e5da5Sopenharmony_ci%14 = OpFunctionCall %void %kill_ 697fd4e5da5Sopenharmony_ciOpBranch %9 698fd4e5da5Sopenharmony_ci%10 = OpLabel 699fd4e5da5Sopenharmony_ciOpReturn 700fd4e5da5Sopenharmony_ciOpFunctionEnd 701fd4e5da5Sopenharmony_ci%kill_ = OpFunction %2 Inline|Pure|Const %3 702fd4e5da5Sopenharmony_ci%4194302 = OpLabel 703fd4e5da5Sopenharmony_ciOpKill 704fd4e5da5Sopenharmony_ciOpFunctionEnd 705fd4e5da5Sopenharmony_ci)"; 706fd4e5da5Sopenharmony_ci 707fd4e5da5Sopenharmony_ci SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); 708fd4e5da5Sopenharmony_ci 709fd4e5da5Sopenharmony_ci std::vector<Message> messages = { 710fd4e5da5Sopenharmony_ci {SPV_MSG_ERROR, "", 0, 0, "ID overflow. Try running compact-ids."}}; 711fd4e5da5Sopenharmony_ci SetMessageConsumer(GetTestMessageConsumer(messages)); 712fd4e5da5Sopenharmony_ci auto result = SinglePassRunToBinary<WrapOpKill>(text, true); 713fd4e5da5Sopenharmony_ci EXPECT_EQ(Pass::Status::Failure, std::get<1>(result)); 714fd4e5da5Sopenharmony_ci} 715fd4e5da5Sopenharmony_ci 716fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, IdBoundOverflow5) { 717fd4e5da5Sopenharmony_ci const std::string text = R"( 718fd4e5da5Sopenharmony_ci OpCapability Shader 719fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 720fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %1 "main" 721fd4e5da5Sopenharmony_ci OpExecutionMode %1 OriginUpperLeft 722fd4e5da5Sopenharmony_ci OpDecorate %void Location 539091968 723fd4e5da5Sopenharmony_ci %void = OpTypeVoid 724fd4e5da5Sopenharmony_ci %3 = OpTypeFunction %void 725fd4e5da5Sopenharmony_ci %float = OpTypeFloat 32 726fd4e5da5Sopenharmony_ci %_struct_5 = OpTypeStruct %float %float 727fd4e5da5Sopenharmony_ci %_struct_6 = OpTypeStruct %_struct_5 728fd4e5da5Sopenharmony_ci%_ptr_Function__struct_6 = OpTypePointer Function %_struct_6 729fd4e5da5Sopenharmony_ci%_ptr_Output_float = OpTypePointer Output %float 730fd4e5da5Sopenharmony_ci %9 = OpTypeFunction %_struct_5 %_ptr_Function__struct_6 731fd4e5da5Sopenharmony_ci %bool = OpTypeBool 732fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 733fd4e5da5Sopenharmony_ci %1 = OpFunction %void None %3 734fd4e5da5Sopenharmony_ci %12 = OpLabel 735fd4e5da5Sopenharmony_ci %13 = OpVariable %_ptr_Function__struct_6 Function 736fd4e5da5Sopenharmony_ci OpBranch %14 737fd4e5da5Sopenharmony_ci %14 = OpLabel 738fd4e5da5Sopenharmony_ci OpLoopMerge %15 %16 None 739fd4e5da5Sopenharmony_ci OpBranch %17 740fd4e5da5Sopenharmony_ci %17 = OpLabel 741fd4e5da5Sopenharmony_ci OpBranchConditional %true %18 %15 742fd4e5da5Sopenharmony_ci %18 = OpLabel 743fd4e5da5Sopenharmony_ci OpBranch %16 744fd4e5da5Sopenharmony_ci %16 = OpLabel 745fd4e5da5Sopenharmony_ci %19 = OpFunctionCall %void %20 746fd4e5da5Sopenharmony_ci %21 = OpFunctionCall %_struct_5 %22 %13 747fd4e5da5Sopenharmony_ci OpBranch %14 748fd4e5da5Sopenharmony_ci %15 = OpLabel 749fd4e5da5Sopenharmony_ci OpReturn 750fd4e5da5Sopenharmony_ci OpFunctionEnd 751fd4e5da5Sopenharmony_ci %20 = OpFunction %void Inline|Pure|Const %3 752fd4e5da5Sopenharmony_ci %23 = OpLabel 753fd4e5da5Sopenharmony_ci %24 = OpVariable %_ptr_Function__struct_6 Function 754fd4e5da5Sopenharmony_ci %25 = OpFunctionCall %_struct_5 %26 %24 755fd4e5da5Sopenharmony_ci OpKill 756fd4e5da5Sopenharmony_ci OpFunctionEnd 757fd4e5da5Sopenharmony_ci %26 = OpFunction %_struct_5 None %9 758fd4e5da5Sopenharmony_ci %27 = OpLabel 759fd4e5da5Sopenharmony_ci OpUnreachable 760fd4e5da5Sopenharmony_ci OpFunctionEnd 761fd4e5da5Sopenharmony_ci %22 = OpFunction %_struct_5 Inline %9 762fd4e5da5Sopenharmony_ci %4194295 = OpLabel 763fd4e5da5Sopenharmony_ci OpKill 764fd4e5da5Sopenharmony_ci OpFunctionEnd 765fd4e5da5Sopenharmony_ci)"; 766fd4e5da5Sopenharmony_ci 767fd4e5da5Sopenharmony_ci SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); 768fd4e5da5Sopenharmony_ci 769fd4e5da5Sopenharmony_ci std::vector<Message> messages = { 770fd4e5da5Sopenharmony_ci {SPV_MSG_ERROR, "", 0, 0, "ID overflow. Try running compact-ids."}}; 771fd4e5da5Sopenharmony_ci SetMessageConsumer(GetTestMessageConsumer(messages)); 772fd4e5da5Sopenharmony_ci auto result = SinglePassRunToBinary<WrapOpKill>(text, true); 773fd4e5da5Sopenharmony_ci EXPECT_EQ(Pass::Status::Failure, std::get<1>(result)); 774fd4e5da5Sopenharmony_ci} 775fd4e5da5Sopenharmony_ci 776fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, SkipEntryPoint) { 777fd4e5da5Sopenharmony_ci const std::string text = R"( 778fd4e5da5Sopenharmony_ciOpCapability GeometryStreams 779fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450 780fd4e5da5Sopenharmony_ciOpEntryPoint Fragment %4 "main" 781fd4e5da5Sopenharmony_ciOpExecutionMode %4 OriginUpperLeft 782fd4e5da5Sopenharmony_ci%2 = OpTypeVoid 783fd4e5da5Sopenharmony_ci%3 = OpTypeFunction %2 784fd4e5da5Sopenharmony_ci%4 = OpFunction %2 Pure|Const %3 785fd4e5da5Sopenharmony_ci%5 = OpLabel 786fd4e5da5Sopenharmony_ciOpKill 787fd4e5da5Sopenharmony_ciOpFunctionEnd 788fd4e5da5Sopenharmony_ci)"; 789fd4e5da5Sopenharmony_ci 790fd4e5da5Sopenharmony_ci auto result = SinglePassRunToBinary<WrapOpKill>(text, true); 791fd4e5da5Sopenharmony_ci EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); 792fd4e5da5Sopenharmony_ci} 793fd4e5da5Sopenharmony_ci 794fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, SkipFunctionNotInContinue) { 795fd4e5da5Sopenharmony_ci const std::string text = R"( 796fd4e5da5Sopenharmony_ciOpCapability GeometryStreams 797fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450 798fd4e5da5Sopenharmony_ciOpEntryPoint Fragment %main "main" 799fd4e5da5Sopenharmony_ciOpExecutionMode %main OriginUpperLeft 800fd4e5da5Sopenharmony_ci%2 = OpTypeVoid 801fd4e5da5Sopenharmony_ci%3 = OpTypeFunction %2 802fd4e5da5Sopenharmony_ci%bool = OpTypeBool 803fd4e5da5Sopenharmony_ci%true = OpConstantTrue %bool 804fd4e5da5Sopenharmony_ci%main = OpFunction %2 None %3 805fd4e5da5Sopenharmony_ci%6 = OpLabel 806fd4e5da5Sopenharmony_ci%7 = OpFunctionCall %void %4 807fd4e5da5Sopenharmony_ciOpReturn 808fd4e5da5Sopenharmony_ciOpFunctionEnd 809fd4e5da5Sopenharmony_ci%4 = OpFunction %2 Pure|Const %3 810fd4e5da5Sopenharmony_ci%5 = OpLabel 811fd4e5da5Sopenharmony_ciOpKill 812fd4e5da5Sopenharmony_ciOpFunctionEnd 813fd4e5da5Sopenharmony_ci)"; 814fd4e5da5Sopenharmony_ci 815fd4e5da5Sopenharmony_ci auto result = SinglePassRunToBinary<WrapOpKill>(text, true); 816fd4e5da5Sopenharmony_ci EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); 817fd4e5da5Sopenharmony_ci} 818fd4e5da5Sopenharmony_ci 819fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, SetParentBlock) { 820fd4e5da5Sopenharmony_ci const std::string text = R"( 821fd4e5da5Sopenharmony_ciOpCapability Shader 822fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450 823fd4e5da5Sopenharmony_ciOpEntryPoint Fragment %main "main" 824fd4e5da5Sopenharmony_ciOpExecutionMode %main OriginUpperLeft 825fd4e5da5Sopenharmony_ci%void = OpTypeVoid 826fd4e5da5Sopenharmony_ci%bool = OpTypeBool 827fd4e5da5Sopenharmony_ci%undef = OpUndef %bool 828fd4e5da5Sopenharmony_ci%void_fn = OpTypeFunction %void 829fd4e5da5Sopenharmony_ci%main = OpFunction %void None %void_fn 830fd4e5da5Sopenharmony_ci%entry = OpLabel 831fd4e5da5Sopenharmony_ciOpBranch %loop 832fd4e5da5Sopenharmony_ci%loop = OpLabel 833fd4e5da5Sopenharmony_ciOpLoopMerge %merge %continue None 834fd4e5da5Sopenharmony_ciOpBranchConditional %undef %merge %continue 835fd4e5da5Sopenharmony_ci%continue = OpLabel 836fd4e5da5Sopenharmony_ci%call = OpFunctionCall %void %kill_func 837fd4e5da5Sopenharmony_ciOpBranch %loop 838fd4e5da5Sopenharmony_ci%merge = OpLabel 839fd4e5da5Sopenharmony_ciOpReturn 840fd4e5da5Sopenharmony_ciOpFunctionEnd 841fd4e5da5Sopenharmony_ci%kill_func = OpFunction %void None %void_fn 842fd4e5da5Sopenharmony_ci%kill_entry = OpLabel 843fd4e5da5Sopenharmony_ciOpKill 844fd4e5da5Sopenharmony_ciOpFunctionEnd 845fd4e5da5Sopenharmony_ci)"; 846fd4e5da5Sopenharmony_ci 847fd4e5da5Sopenharmony_ci auto result = SinglePassRunToBinary<WrapOpKill>(text, true); 848fd4e5da5Sopenharmony_ci EXPECT_EQ(Pass::Status::SuccessWithChange, std::get<1>(result)); 849fd4e5da5Sopenharmony_ci result = SinglePassRunToBinary<WrapOpKill>(text, true); 850fd4e5da5Sopenharmony_ci EXPECT_EQ(Pass::Status::SuccessWithChange, std::get<1>(result)); 851fd4e5da5Sopenharmony_ci} 852fd4e5da5Sopenharmony_ci 853fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, KillInSingleBlockLoop) { 854fd4e5da5Sopenharmony_ci const std::string text = R"( 855fd4e5da5Sopenharmony_ci; CHECK: OpFunction %void 856fd4e5da5Sopenharmony_ci; CHECK: OpFunction %void 857fd4e5da5Sopenharmony_ci; CHECK-NOT: OpKill 858fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %void [[new_kill:%\w+]] 859fd4e5da5Sopenharmony_ci; CHECK-NOT: OpKill 860fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 861fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 862fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpKill 863fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 864fd4e5da5Sopenharmony_ci OpCapability Shader 865fd4e5da5Sopenharmony_ci OpCapability Linkage 866fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 867fd4e5da5Sopenharmony_ci %void = OpTypeVoid 868fd4e5da5Sopenharmony_ci %bool = OpTypeBool 869fd4e5da5Sopenharmony_ci %undef = OpUndef %bool 870fd4e5da5Sopenharmony_ci %void_fn = OpTypeFunction %void 871fd4e5da5Sopenharmony_ci %main = OpFunction %void None %void_fn 872fd4e5da5Sopenharmony_ci%main_entry = OpLabel 873fd4e5da5Sopenharmony_ci OpBranch %loop 874fd4e5da5Sopenharmony_ci %loop = OpLabel 875fd4e5da5Sopenharmony_ci %call = OpFunctionCall %void %sub 876fd4e5da5Sopenharmony_ci OpLoopMerge %exit %loop None 877fd4e5da5Sopenharmony_ci OpBranchConditional %undef %loop %exit 878fd4e5da5Sopenharmony_ci %exit = OpLabel 879fd4e5da5Sopenharmony_ci OpReturn 880fd4e5da5Sopenharmony_ci OpFunctionEnd 881fd4e5da5Sopenharmony_ci %sub = OpFunction %void None %void_fn 882fd4e5da5Sopenharmony_ci %sub_entry = OpLabel 883fd4e5da5Sopenharmony_ci OpSelectionMerge %ret None 884fd4e5da5Sopenharmony_ci OpBranchConditional %undef %kill %ret 885fd4e5da5Sopenharmony_ci %kill = OpLabel 886fd4e5da5Sopenharmony_ci OpKill 887fd4e5da5Sopenharmony_ci %ret = OpLabel 888fd4e5da5Sopenharmony_ci OpReturn 889fd4e5da5Sopenharmony_ci OpFunctionEnd 890fd4e5da5Sopenharmony_ci)"; 891fd4e5da5Sopenharmony_ci 892fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 893fd4e5da5Sopenharmony_ci} 894fd4e5da5Sopenharmony_ci 895fd4e5da5Sopenharmony_ciTEST_F(WrapOpKillTest, DebugInfoSimple) { 896fd4e5da5Sopenharmony_ci const std::string text = R"( 897fd4e5da5Sopenharmony_ci; CHECK: OpEntryPoint Fragment [[main:%\w+]] 898fd4e5da5Sopenharmony_ci; CHECK: [[main]] = OpFunction 899fd4e5da5Sopenharmony_ci; CHECK: OpFunctionCall %void [[orig_kill:%\w+]] 900fd4e5da5Sopenharmony_ci; CHECK: [[orig_kill]] = OpFunction 901fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 902fd4e5da5Sopenharmony_ci; CHECK-NEXT: {{%\d+}} = OpExtInst %void [[ext:%\d+]] DebugScope 903fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLine [[file:%\d+]] 100 200 904fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionCall %void [[new_kill:%\w+]] 905fd4e5da5Sopenharmony_ci; CHECK: {{%\d+}} = OpExtInst %void [[ext]] DebugNoScope 906fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpReturn 907fd4e5da5Sopenharmony_ci; CHECK: [[new_kill]] = OpFunction 908fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpLabel 909fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpKill 910fd4e5da5Sopenharmony_ci; CHECK-NEXT: OpFunctionEnd 911fd4e5da5Sopenharmony_ci OpCapability Shader 912fd4e5da5Sopenharmony_ci %1 = OpExtInstImport "OpenCL.DebugInfo.100" 913fd4e5da5Sopenharmony_ci OpMemoryModel Logical GLSL450 914fd4e5da5Sopenharmony_ci OpEntryPoint Fragment %main "main" 915fd4e5da5Sopenharmony_ci OpExecutionMode %main OriginUpperLeft 916fd4e5da5Sopenharmony_ci %2 = OpString "File name" 917fd4e5da5Sopenharmony_ci OpSource GLSL 330 918fd4e5da5Sopenharmony_ci OpName %main "main" 919fd4e5da5Sopenharmony_ci %void = OpTypeVoid 920fd4e5da5Sopenharmony_ci %5 = OpTypeFunction %void 921fd4e5da5Sopenharmony_ci %bool = OpTypeBool 922fd4e5da5Sopenharmony_ci %true = OpConstantTrue %bool 923fd4e5da5Sopenharmony_ci %3 = OpExtInst %void %1 DebugSource %2 924fd4e5da5Sopenharmony_ci %4 = OpExtInst %void %1 DebugCompilationUnit 0 0 %3 GLSL 925fd4e5da5Sopenharmony_ci %main = OpFunction %void None %5 926fd4e5da5Sopenharmony_ci %8 = OpLabel 927fd4e5da5Sopenharmony_ci OpBranch %9 928fd4e5da5Sopenharmony_ci %9 = OpLabel 929fd4e5da5Sopenharmony_ci OpLoopMerge %10 %11 None 930fd4e5da5Sopenharmony_ci OpBranch %12 931fd4e5da5Sopenharmony_ci %12 = OpLabel 932fd4e5da5Sopenharmony_ci OpBranchConditional %true %13 %10 933fd4e5da5Sopenharmony_ci %13 = OpLabel 934fd4e5da5Sopenharmony_ci OpBranch %11 935fd4e5da5Sopenharmony_ci %11 = OpLabel 936fd4e5da5Sopenharmony_ci %14 = OpFunctionCall %void %kill_ 937fd4e5da5Sopenharmony_ci OpBranch %9 938fd4e5da5Sopenharmony_ci %10 = OpLabel 939fd4e5da5Sopenharmony_ci OpReturn 940fd4e5da5Sopenharmony_ci OpFunctionEnd 941fd4e5da5Sopenharmony_ci %kill_ = OpFunction %void None %5 942fd4e5da5Sopenharmony_ci %15 = OpLabel 943fd4e5da5Sopenharmony_ci %16 = OpExtInst %void %1 DebugScope %4 944fd4e5da5Sopenharmony_ci OpLine %2 100 200 945fd4e5da5Sopenharmony_ci OpKill 946fd4e5da5Sopenharmony_ci OpFunctionEnd 947fd4e5da5Sopenharmony_ci )"; 948fd4e5da5Sopenharmony_ci 949fd4e5da5Sopenharmony_ci SinglePassRunAndMatch<WrapOpKill>(text, true); 950fd4e5da5Sopenharmony_ci} 951fd4e5da5Sopenharmony_ci 952fd4e5da5Sopenharmony_ci} // namespace 953fd4e5da5Sopenharmony_ci} // namespace opt 954fd4e5da5Sopenharmony_ci} // namespace spvtools 955