AllocaOp verifies that the returned address type is the pointer of the allocated type, e.g. u64 * and u64. The dynamic allocation builtins, in general, are allocating buffers of size size bytes and returning void * pointers. To support this in #547, we introduced an AllocaOp of type u8, and had to later on bitcast the return address to void *. Usually right afterwards, the user of the builtin dynamic alloca will cast the operation to its intended value, e.g.
int *a = (int *)__builtin_alloca(sizeof(int) * size);
We should define a method to remove this redundant bitcasts by either (or both):
Allowing AllocaOp to have different address type than allocation type
AllocaOp
verifies that the returned address type is the pointer of the allocated type, e.g.u64 *
andu64
. The dynamic allocation builtins, in general, are allocating buffers of sizesize
bytes and returningvoid *
pointers. To support this in #547, we introduced anAllocaOp
of typeu8
, and had to later on bitcast the return address tovoid *
. Usually right afterwards, the user of the builtin dynamic alloca will cast the operation to its intended value, e.g.We should define a method to remove this redundant bitcasts by either (or both):
AllocaOp
to have different address type than allocation typeCastOp::fold
.