memcmp code fragment

Some newb questions:
Is this unrolled loop a pattern that loop reroll gets? If not, then can/could/should it be enhanced to get it? Does loop idiom run after reroll?

Loop idiom currently doesn’t have a pattern match for memcmp — there is no llvm.memcmp intrinsic. But, this looks like a good motivating example to create one...


Loop reroll will not get this pattern. Loop reroll only works on a loop. There is no loop around this code sequence, neither was it unroll. In this case, it’s the code as is. But I do see your point, unrolling would result in such a code sequence as well. And maybe we need to teach loop idiom to recognize this patterm and have llvm intrinsic for it.

To answer your question, loop idiom runs before loop reroll.