sdesmalen added inline comments.

================
Comment at: clang/lib/CodeGen/CGCall.cpp:2856
         Address AddrToStoreInto = Address::invalid();
-        if (SrcSize <= DstSize) {
+        if (llvm::TypeSize::isKnownLE(SrcSize, DstSize)) {
           AddrToStoreInto = Builder.CreateElementBitCast(Ptr, STy);
----------------
Can we assume their scalable flags must match? In that case, it's best to 
assert this.

`llvm::TypeSize::isKnownLE()` should be used with some caution, because 
`isKnownLE(4, vscale x 4)` evaluates to true, so if their scalable flags don't 
match, this may lead to surprising results.


================
Comment at: clang/lib/CodeGen/CGCall.cpp:4929
                                Src.getName() + ".coerce");
-          Builder.CreateMemCpy(TempAlloca, Src, SrcSize);
+          Builder.CreateMemCpy(TempAlloca, Src, SrcSize.getKnownMinSize());
           Src = TempAlloca;
----------------
This doesn't seem correct for scalable vectors.
If you expect it to work only for fixed-width vectors, you should use 
`getFixedSize` instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99592

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to