You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A masked load that reads an array element into a temporary is sunk below the masked store that overwrites that same element, so the temporary receives the value that was just written. In a classic swap
constfloat tmp = hits[i];
hits[i] = cur;
cur = tmp; // <-- ends up as cur = cur
cur never changes and the array is filled with copies of a single element.
Thanks a lot for reporting this issue. It's a regression in LLVM (22.1, 23, trunk): llvm/llvm-project#215453. I'll apply LLVM patch to ISPC as soon as it lands in the upstream.
Activity
aneshlya commentedon Aug 11, 2026
Hi @johguenther,
Thanks a lot for reporting this issue. It's a regression in LLVM (22.1, 23, trunk): llvm/llvm-project#215453. I'll apply LLVM patch to ISPC as soon as it lands in the upstream.
[InstCombine] Fix miscompile when folding a select into a masked load (…
Automerge: [InstCombine] Fix miscompile when folding a select into a …
[InstCombine] Fix miscompile when folding a select into a masked load (…
[InstCombine] Fix miscompile when folding a select into a masked load (…
Automerge: [InstCombine] Fix miscompile when folding a select into a …
[InstCombine] Fix miscompile when folding a select into a masked load (…
Automerge: [InstCombine] Fix miscompile when folding a select into a …
Automerge: [InstCombine] Fix miscompile when folding a select into a …
[InstCombine] Fix miscompile when folding a select into a masked load…
Fix #3891: Add LLVM 22.1 patch for select into masked load miscompile