[PATCH] D120260: [BOLT][NFC] Fix undefined behavior in encodeAnnotationImm
    Vladislav Khmelevsky via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Feb 21 09:49:37 PST 2022
    
    
  
yota9 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");
----------------
May I suggest with replacing assert with if condition? I think it is the important thing that we should check with disabled assertions too.
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