[llvm] e6419d3 - [MC] [Win64EH] Fix builds with expensive checks enabled

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 01:18:22 PDT 2020


Author: Martin Storsjö
Date: 2020-09-11T11:17:01+03:00
New Revision: e6419d320d501077d1c5e1e7e1291a1ec6573877

URL: https://github.com/llvm/llvm-project/commit/e6419d320d501077d1c5e1e7e1291a1ec6573877
DIFF: https://github.com/llvm/llvm-project/commit/e6419d320d501077d1c5e1e7e1291a1ec6573877.diff

LOG: [MC] [Win64EH] Fix builds with expensive checks enabled

This fixes a failed assert if expensive checks are enabled,
since 1308bb99e06752ab0b5175c92da31083f91af921.

Added: 
    

Modified: 
    llvm/lib/MC/MCWin64EH.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp
index a585b5082837..8e8dba760853 100644
--- a/llvm/lib/MC/MCWin64EH.cpp
+++ b/llvm/lib/MC/MCWin64EH.cpp
@@ -632,9 +632,11 @@ static int checkPackedEpilog(MCStreamer &streamer, WinEH::FrameInfo *info,
   if (DistanceFromEnd / 4 != Epilog.size())
     return -1;
 
-  int Offset = ARM64CountOfUnwindCodes(
-      ArrayRef<WinEH::Instruction>(&info->Instructions[Epilog.size()],
-                                   info->Instructions.size() - Epilog.size()));
+  int Offset = Epilog.size() == info->Instructions.size()
+                   ? 0
+                   : ARM64CountOfUnwindCodes(ArrayRef<WinEH::Instruction>(
+                         &info->Instructions[Epilog.size()],
+                         info->Instructions.size() - Epilog.size()));
 
   // Check that the offset and prolog size fits in the first word; it's
   // unclear whether the epilog count in the extension word can be taken


        


More information about the llvm-commits mailing list