[llvm-branch-commits] [llvm] [AtomicExpand] Add bitcasts when expanding store atomic vector (PR #197862)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri May 15 03:22:35 PDT 2026
================
@@ -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
More information about the llvm-branch-commits
mailing list