Repository navigation
[Validation] Make validator reject unsupported llvm integer sizes - #8207
Merged
Damyan Pepper (damyanp) merged 7 commits intoMar 10, 2026
Merged
Damyan Pepper (damyanp) merged 7 commits into
Damyan Pepper (damyanp) merged 7 commits into
Conversation
…ds and results Extends the existing i8 check in the instruction validation loop to also reject integer types with non-standard widths (anything other than i1/i8/i16/i32/i64). This catches cases where optimizations produce odd-sized types like i25 that are not valid DXIL types. Adds a LIT test that verifies i25 types are rejected by the validator. Fixes microsoft#6563 Co-authored-by: damyanp <[email protected]>
Address review feedback: - Replace if/else chains with switch statements for both operand and result type integer width validation - Simplify LIT test to minimal IR with a single i25 add instruction Co-authored-by: damyanp <[email protected]>
Add a select instruction with [2 x i25] result type to exercise the array unwrapping path in the result type integer width validation. Co-authored-by: damyanp <[email protected]>
Consolidate three duplicate bit width checks into a single IsValidIntBitWidth(unsigned) helper used by ValidateType and both instruction-level checks. Co-authored-by: damyanp <[email protected]>
Co-authored-by: damyanp <[email protected]>
| // We always fail if we see i8 as operand type of a non-lifetime | ||
| // instruction. | ||
| ValCtx.EmitInstrError(&I, ValidationRule::TypesI8); | ||
| } else if (!IsValidIntBitWidth(BW)) { |
Collaborator
There was a problem hiding this comment.
ValidateFunctionBody will call ValidateType in certain scenarios. I wonder if your test will pass without these two else ifs?
If it is possible, it is better to designate one location for validating types, and that function and your changes to it seem like the perfect fix.
And if not, then maybe calling ValidateType instead of the else if would be better?
For example, I wonder if calling ValidateType once at 3377 will do the same as these two else ifs.
Member
Author
There was a problem hiding this comment.
Nice catch, I think that works out nicer!
Damyan Pepper (damyanp)
requested review from
Joshua Batista (bob80905) and
Tex Riddell (tex3d)
February 27, 2026 01:57
Joshua Batista (bob80905)
approved these changes
Feb 27, 2026
Damyan Pepper (damyanp)
deleted the
copilot/fix-test-failures-issue-6563
branch
March 11, 2026 00:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are a limited number of supported integer sizes in DXIL. This change updates the validator to reject shaders that use unsupported integer sizes.
Fixes #6563