microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] Fold constant instructions when there's `-Gis` flag

Open
#7,732 0 comments 0 reactions 1 assignee View on GitHub

@luciechoi is already working on this.

Since Sep 3, 2025.

bug spirv
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

https://godbolt.org/z/95WvzPfYz

Description
Context

We should fold certain instructions even when there's -Gis flag, such when all parameters are known constants.

Steps to Reproduce

// RUN: %dxc -spirv -fspv-target-env=vulkan1.3 -enable-16bit-types -Gis -HV 202x -T cs_6_5 %s

RWStructuredBuffer<float4> Out1 : register(u5);

[numthreads(1,1,1)]
void main() {
    // both of these are hitting the assert
    Out1[0] = pow(float4(2, 4, 1.5, 8), float4(3, 0.5, 2, 0.33333333));
}

is said to produce the error

# .---command stderr------------
# | Internal compiler error: LLVM Assert
# `-----------------------------
# error: command failed with exit status: 0xe0000001
Error: assert((!HasStatus(inst) || Status(inst) != SSAPropagator::kNotInteresting) && "Unsettled value")
File:
/home/kaitlinpeng/DirectXShaderCompiler/external/SPIRV-Tools/source/opt/propagator.cpp(265)
Func:   operator()
Illegal instruction (core dumped)

Actual Behavior
The instructions shouldn't throw errors and properly fold even when there's -Gis flag.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.