[llvm] [AArch64] Add MATCH loops to LoopIdiomVectorizePass (PR #101976)
Ricardo Jesus via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 06:27:59 PST 2024
rj-jesus wrote:
> The patch is looking mostly good. I've still got a bit more to review, but at the moment there is a serious bug with this so can you hold off landing this until it's fixed?
Of course, I will do, thank you very much for the heads up!
> The inner loop can exit early before you've loaded the rest of the needle so it needs memory checks before entering the vector loop to ensure the needle doesn't cross a page boundary.
> In fact, I think we need page boundary checks for the pointer in the outer loop as well. Suppose you find a match in your needle after only two iterations in your scalar outer loop? Your third iteration could cross a page boundary and seg fault. The scalar version of the loop will be fine because we exited before the fault, but the vector version will crash.
I think I'm missing something. We should never be reading beyond the end of the search or needle arrays (if we do, that's definitely a bug), so I don't think we would be prone to segfaulting. The idea was to use `llvm.get.active.lane.mask` to create a valid predicate for the loads, shouldn't that work?
https://github.com/llvm/llvm-project/pull/101976
More information about the llvm-commits
mailing list