[PATCH] D63274: [RISCV] Avoid overflow when determining number of nops for code align
    Lewis Revill via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Jun 13 08:56:08 PDT 2019
    
    
  
lewis-revill added inline comments.
================
Comment at: lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp:320
 
-  Size = AF.getAlignment() - MinNopLen;
+  Size = (AF.getAlignment() < MinNopLen) ? 0 : (AF.getAlignment() - MinNopLen);
   return true;
----------------
Shouldn't make any functional difference but can we return false instead? Seems more prudent to say we 'shouldn't emit nops' rather than saying we should but the size should be 0?
Repository:
  rL LLVM
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63274/new/
https://reviews.llvm.org/D63274
    
    
More information about the llvm-commits
mailing list