Most efficient way to check if a <n x i1> vector only contains 1s

Hi all,

What’s is the most efficient way to check if a vectorType Value a only contains 1s in LLVM, where n is even? I tried to extract each element and then insert an ICmpInst with low efficiency because I didn’t see a reduction operation. Is there any better way?

Best,
Zhi

BTW, I also used bitcast to cast to i_n and then compare it with a n-bit data with all 1s to check equivalence. But it seemed that it was still slow.

Best,
Zhi