[PATCH] D157462: LoopRotate: Add code to update branch weights
Wenlei He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 22 15:56:43 PDT 2023
wenlei added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/LoopRotationUtils.cpp:308
+ // ... but don't overflow.
+ uint32_t const high_bit = uint32_t{1} << (sizeof(uint32_t) * 8 - 1);
+ if (OrigLoopBackedgeCount + OrigLoopExitCount >= high_bit) {
----------------
nit: follow convention for variable naming.
================
Comment at: llvm/lib/Transforms/Utils/LoopRotationUtils.cpp:309-310
+ uint32_t const high_bit = uint32_t{1} << (sizeof(uint32_t) * 8 - 1);
+ if (OrigLoopBackedgeCount + OrigLoopExitCount >= high_bit) {
+ break;
+ }
----------------
Could `OrigLoopBackedgeCount + OrigLoopExitCount` already overflow and defeat the check?
Maybe spell it explicitly with `OrigLoopBackedgeCount >= high_bit || OrigLoopExitCount >= high_bit`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157462/new/
https://reviews.llvm.org/D157462
More information about the llvm-commits
mailing list