[clang] [HLSL] Update indexed vector elements individually (PR #169144)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 24 15:50:56 PST 2025
================
@@ -2575,6 +2575,30 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
bool isInit) {
if (!Dst.isSimple()) {
if (Dst.isVectorElt()) {
+ if (getLangOpts().HLSL) {
+ // In HLSL, storing to individual elements of a vector through
+ // VectorElt LValue needs to be handled as separate store. We need to
+ // avoid the load/modify/store sequence to prevent overwriting other
+ // elements that might be getting updated in parallel.
----------------
bogner wrote:
The wording on this comment is a bit confusing in the way it talks about "avoiding RMW". Would it be better to just state that accesses to individual vector elements are modelled as such, and so we access them directly?
https://github.com/llvm/llvm-project/pull/169144
More information about the cfe-commits
mailing list