[PATCH] D149006: [llvm][Support] Replace `%` operator with `&` in `Align::isAligned(...)`

Sviatoslav Osipov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 28 03:43:36 PDT 2023


Stoorx added a comment.

> easier in what respect?

I mean, easier for CPU :-)

The division operation reasonably seems to be more complex than bitwise AND. And since this function is pretty hot it can save a bit of performance.
(Actually that's just my assumption. I did not make benchmark really.)

Side thought: I suspect some advanced CPUs can optimize such kind of divisions by powers of 2 by themselves.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149006/new/

https://reviews.llvm.org/D149006



More information about the cfe-commits mailing list