Open bonjune opened 2 months ago
LangRef doesn't specify the behavior of bit-casting a vector with poison elements into a scalar. See also https://llvm.org/docs/LangRef.html#bitcast-to-instruction.
cc @nikic @nunoplopes
LangRef doesn't specify the behavior of bit-casting a vector with poison elements into a scalar. See also https://llvm.org/docs/LangRef.html#bitcast-to-instruction.
cc @nikic @nunoplopes
It has to be poison. There's no way around it, otherwise bitcast would act like freeze and wouldn't be a noop as it should be.
Whether this is a miscompile depends on whether poison is allowed in memory :)
Another example of this miscompilation: https://alive2.llvm.org/ce/z/jy4ayt
alive2 report: https://alive2.llvm.org/ce/z/-RsHE_
%val4
is loaded as<4 x i32>
and then loaded again asi64
. This secondload
is replaced bytrunc i64 (bitcast <4 x i32> %val4 to i128)
.But if an element of the vector is
poison
, the result oftrunc (bitcast ...)
ispoison
intgt
, while the result is just concatenation of the first two elements insrc
.