Is bitcast now needed in LLVM?

Seems like a new change in LLVM has made it so that bitcast of bitcast i8* %1 to %Foo* meaningless?

If I’m correct is there any need for the bitcast anymore?

Hi Dave,

You can still bitcast between i32 and float, for example.

Cheers,

James

I always thought that bitcast was a no-op internal llvm thing to fit the IR type system.

I currently use sitofp, but I see your point.

Hi,

sitofp has different semantics to bitcast. “bitcast i32 %a to float” would not do int-to-float conversion, but would perform the equivalent of “f = *&i;”.

Also, bitcast is still not a no-op in AArch64 big endian - we have to do vector shuffling still.

Cheers,

James

Got it. Thanks for clearing that up.

Seems like a new change in LLVM has made it so that bitcast of bitcast i8* %1 to %Foo* meaningless?

If I’m correct is there any need for the bitcast anymore?

What particular observations are you referring to that gave you the impression that these were not needed?

I’m part-way through migrating LLVM to not depend on the type a pointer points to, with the intent to eventually remove typed pointers in favor of a type less pointer type and remove all pointer to pointer bitcasts, but that work is far from complete.