llvm::all_equal checks if all values in the given range are equal, i.e., there are no two elements that are not equal.
Similar to llvm::all_of, it returns true when the range is empty.
llvm::all_equal is intended to supersede llvm::is_splat, which will be deprecated and removed in future patches.
See the discussion thread for more details:
https://discourse.llvm.org/t/adt-is-splat-and-empty-ranges/64692.
Hi! Just wondering, why does this use std::equal-- which compares ranges (here, range of [2nd to last] vs [1st to (last-1)])-- instead of something like llvm::all_of(Range,[&](auto x)(return x == *Begin;)?
Does this have advantages? Seems slightly more expensive this way, is why I'm asking, but I haven't bounced through the generated code or such.