[PATCH] D63285: [RISCV] Fix a potential issue in shouldInsertFixupForCodeAlign()

Edward Jones via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 04:48:32 PDT 2019


edward-jones updated this revision to Diff 205554.
edward-jones added a comment.

Rebased


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

https://reviews.llvm.org/D63285

Files:
  lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp


Index: lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
===================================================================
--- lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
+++ lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
@@ -329,11 +329,10 @@
   if (!STI.getFeatureBits()[RISCV::FeatureRelax])
     return false;
 
-  // Calculate total Nops we need to insert.
+  // Calculate total Nops we need to insert. If there are none to insert
+  // then simply return.
   unsigned Count;
-  shouldInsertExtraNopBytesForCodeAlign(AF, Count);
-  // No Nop need to insert, simply return.
-  if (Count == 0)
+  if (!shouldInsertExtraNopBytesForCodeAlign(AF, Count) || (Count == 0))
     return false;
 
   MCContext &Ctx = Asm.getContext();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63285.205554.patch
Type: text/x-patch
Size: 741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190619/c80eab95/attachment.bin>


More information about the llvm-commits mailing list