[llvm] IR/Verifier: Allow vector type in atomic load and store (PR #120384)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 08:02:12 PST 2024


jofrn wrote:

> There's a crash in AtomicExpandPass with vectors, `llc -mtriple arm-none-none` crashes on:
> 
> ```
> define <1 x ptr> @atomic_vec1_ptr(ptr %x) #0 {
>   %ret = load atomic <1 x ptr>, ptr %x acquire, align 4
>   ret <1 x ptr> %ret
> }
> ```
> 
> ```
> llc: llvm/lib/IR/Instructions.cpp:2974: static llvm::CastInst *llvm::CastInst::Create(Instruction::CastOps, llvm::Value *, llvm::Type *, const llvm::Twine &, llvm::InsertPosition): Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
> ```
> 
> Call at llvm/lib/CodeGen/AtomicExpandPass.cpp:2064:19 errors; it apparently tries to create a cast from `i32` to `<1 x ptr>` with an `inttoptr`, but that doesn't work.
> 
> A lot more test coverage than is currently present in this series is going to be needed.

I tried `%ret = load atomic <2 x ptr>, ptr %x acquire, align 16` with `llc`, and it failed with an `%2 = inttoptr i128 %1 to <2 x ptr>`.

It seems we either need to overload on the atomic return value or give inttoptr the ability to cast between these.

https://github.com/llvm/llvm-project/pull/120384


More information about the llvm-commits mailing list