[PATCH] D107963: [OpenCL] Fix as_type(vec3) invalid store creation

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 17 05:25:05 PDT 2021


Anastasia accepted this revision.
Anastasia added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/CodeGen/CGExprScalar.cpp:4789
-
-    if (!CGF.CGM.getCodeGenOpts().PreserveVec3Type) {
-      Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
----------------
While I agree with this fix and it obviously looks incorrect, I wonder if the original intent was to condition the previous statement instead so that we avoid converting to size 4 at all? Although I have a feeling we are entering the behavior that is not documented anywhere. In the spec I can see this:


```
When the operand and result type contain a different number of elements, the result shall be implementation-defined except if the operand is a 4-component vector and the result is a 3-component vector. In this case, the bits in the operand shall be returned directly without modification as the new type. 
```

but it seems to cover the inverse conversion?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107963/new/

https://reviews.llvm.org/D107963



More information about the cfe-commits mailing list