Repository navigation
Conversation
PromoteSubByte visits the module with an InstVisitor while promoting it. Promoting an instruction can promote instructions further down its block (a PHI node's back-edge value, for example), inserting their replacements ahead of the visitor. The visitor then promotes those replacements again, which records them in the promotion cache, and cleanUp() erases them while other replacements still use them. Their users end up with undef operands: a loop that carries an i1 through a PHI node loses the value. Visit only the instructions that existed before promotion started. Signed-off-by: Tim Besard <tim.besard@gmail.com>
This was referenced Oct 10, 2026
This branch has not been deployed
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.
PromoteSubByte::runvisits the module with anInstVisitorwhile promoting it. Promotion can recurse through a loop PHI to its back-edge value later in the block, inserting replacement instructions ahead of the visitor. The visitor then promotes those replacements again and records them inpromotedValuesCache.cleanUp()erases them while other replacements still use them, leavingpoisonoperands and incorrect results.Visit a snapshot of the instructions that existed before promotion started. The snapshot is taken after function promotion so cloned bodies are included; instructions are only erased during cleanup.
The new LIT test
i1/phinodes-loop-carried.llreproduces the failure:%w = icmp ne i1 %v, %ubecomesicmp ne i8 poison, ...without the fix.Found while investigating JuliaGPU/oneAPI.jl#678. The fix has been backported in JuliaPackaging/Yggdrasil#15068 (libigc_jll 2.34.4+3) and validated on Intel Iris Xe with Julia 1.12 and bounds checks enabled: the original reduction reproducer is correct, the standalone kernel goes from 256 incorrect work-items to zero, and the minimal driver-compiled kernel no longer contains undefined operands after PromoteSubByte.
Validation: all 38 current
i1/test files pass through a standalone build of this pass and FileCheck; the new regression fails without the fix. This standalone harness uses LLVM 16 and header shims, so it does not replace a full IGC LIT run and does not cover the GenISA int4 intrinsics.The Julia-side regression is in JuliaGPU/oneAPI.jl#679. Its equal-input check fails with libigc_jll 2.34.4+2 and passes with +3.