[PATCH] D120260: [BOLT][NFC] Fix undefined behavior in encodeAnnotationImm

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 21 10:58:17 PST 2022


Amir added inline comments.


================
Comment at: bolt/include/bolt/Core/MCPlusAnnotation.h:21
+  assert(Index < 256 && "annotation index max value exceeded");
+  assert(Value == llvm::SignExtend64<56>(Value & 0xff'ffff'ffff'ffff) &&
+         "annotation value out of range");
----------------
yota9 wrote:
> May I suggest with replacing assert with if condition? I think it is the important thing that we should check with disabled assertions too.
Good point.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120260



More information about the llvm-commits mailing list