[llvm] [IR] Allow vector atomicrmw xchg (PR #208510)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 14 03:55:20 PDT 2026
https://github.com/antoniofrighetto commented:
Don't we need to use CreateBitPreservingCastChain() or similar in convertAtomicXchgToIntegerType() too, exactly like we would do for cmpxchg in follow-up https://github.com/llvm/llvm-project/pull/209386? It looks like the expansion is trying to bitcast a pointer vector directly into a scalar integer when `<1 x ptr>` is treated as `i32`:
```llvm
; ./bin/opt -S -mtriple=mipsel-linux-gnu -passes='require<libcall-lowering-info>,atomic-expand' test.ll
define <1 x ptr> @atomicrmw_xchg_one_ptr(ptr %p, <1 x ptr> %v) {
%r = atomicrmw xchg ptr %p, <1 x ptr> %v monotonic
ret <1 x ptr> %r
}
```
```
opt: llvm-project/llvm/lib/IR/Instructions.cpp:3109: static CastInst *llvm::CastInst::Create(Instruction::CastOps, Value *, Type *, const Twine &, InsertPosition): Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
```
https://github.com/llvm/llvm-project/pull/208510
More information about the llvm-commits
mailing list