Skip to content

spirv-opt: CCP pass changes module and returns SuccessWithoutChange (2) #3991

@Vasniktel

Description

@Vasniktel

data.zip

The following shader

               OpCapability Shader
          %1 = OpExtInstImport "GLSL.std.450"
               OpMemoryModel Logical GLSL450
               OpEntryPoint Fragment %4 "main"
               OpExecutionMode %4 OriginUpperLeft
          %2 = OpTypeVoid
          %3 = OpTypeFunction %2
          %8 = OpTypeFloat 32
         %12 = OpTypeVector %8 3
         %87 = OpTypeInt 32 0
         %88 = OpConstant %87 0
        %153 = OpTypeBool
        %398 = OpConstant %8 0
        %399 = OpConstantComposite %12 %398 %398 %398
        %533 = OpConstant %8 0.300000012
        %534 = OpConstantComposite %12 %533 %533 %533
          %4 = OpFunction %2 None %3
          %5 = OpLabel
         %20 = OpBitcast %87 %533
       %3184 = OpUGreaterThan %153 %20 %88
               OpBranch %597
        %597 = OpLabel
       %2975 = OpPhi %12 %399 %5 %534 %660
               OpLoopMerge %663 %660 None
               OpBranchConditional %3184 %660 %663
        %660 = OpLabel
               OpBranch %597
        %663 = OpLabel
        %535 = OpExtInst %12 %1 FMix %399 %2975 %534
               OpReturn
               OpFunctionEnd

produces an error

spirv-opt: spirv-repo/source/opt/optimizer.cpp:598: bool spvtools::Optimizer::Run(const uint32_t *, const size_t, std::vector<uint32_t> *, const spv_optimizer_options) const: Assertion `optimized_binary_with_nop.size() == original_binary_size && "Binary size unexpectedly changed despite the optimizer saying " "there was no change"' failed.

when executed with spirv-opt --ccp --validate-after-all <attached file> -o out.spv.

Can be reproduced on 69f07da.

This appears to be some kind of corner case unhandled in #3738.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions