[PATCH] D106701: [clang] Implement -falign-loops=N (N is a power of 2) for non-LTO

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 6 20:04:24 PDT 2021


MaskRay added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4749
+          << A->getAsString(Args) << A->getValue();
+    else if (Value & Value - 1)
+      TC.getDriver().Diag(diag::err_drv_alignment_not_power_of_two)
----------------
craig.topper wrote:
> gcc 5.4 is throwing a -Wparentheses warning here. I'm in the middle of something else in my tree or I would just fix it. Maybe isPowerOf2_32 would be more readable anyway?
maybe just add parens (Value - 1) ... this is probably a quite common pattern. And the line below has `err_drv_alignment_not_power_of_two` which is self-explanatory.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106701



More information about the cfe-commits mailing list