================
@@ -2174,8 +2176,19 @@ bool AtomicExpandImpl::expandAtomicOpToLibcall(
   // 'val' argument ('desired' for cas), if present.
   if (ValueOperand) {
     if (UseSizedLibcall) {
-      Value *IntValue =
-          Builder.CreateBitOrPointerCast(ValueOperand, SizedIntTy);
+      // Add casts from ValueOperand's <n x ptr> vector type to Result's
+      // scalar integer type. Mirror of the load-side handling below.
+      Value *IntValue;
+      auto *VPtrTy =
+          dyn_cast<PointerType>(ValueOperand->getType()->getScalarType());
+      auto *VTy = dyn_cast<VectorType>(ValueOperand->getType());
+      if (VTy && VPtrTy && !SizedIntTy->isVectorTy()) {
+        unsigned AS = VPtrTy->getAddressSpace();
+        Value *PtrInt = Builder.CreatePtrToInt(
+            ValueOperand, VTy->getWithNewType(DL.getIntPtrType(Ctx, AS)));
+        IntValue = Builder.CreateBitCast(PtrInt, SizedIntTy);
----------------
jofrn wrote:

Thanks! I shall do so.

https://github.com/llvm/llvm-project/pull/197862
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to