This patch is just an initial sketch to get a discussion going on how to
best support generating runtime checks for may-aliasing memory accesses.
The key question to start with is where to best collect and generate
runtime checks. Currently codegen for a block is eager; for each block,
if we find a vectorizable tree, we vectorize it and then analyze the
rest of the block. This makes it hard to collect *all* runtime checks
for a block before changing the code.
Perhaps for now we need to limit the checks to the first vectorizable
tree in a block? This is what the patch tries to do.
There are a couple of mechanical/technical issues that need to be
addressed, but I think the questions above are key to answer/address
first.
Other than that, the patch does not yet consider the cost of cloning
the block and the runtime checks. It also does not introduce phis
for values used outside the cloned block, so it will generate invalid IR
in those cases for now.
Convert this to enum? + add comments