aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCWin64EH.cpp
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2020-09-11 11:14:45 +0300
committerMartin Storsjö <martin@martin.st>2020-09-11 11:17:01 +0300
commite6419d320d501077d1c5e1e7e1291a1ec6573877 (patch)
treeff422731fc187e41d4564df551d56cae1e9292ba /llvm/lib/MC/MCWin64EH.cpp
parenta68673cc067a190f5a9d0f0e3e4837601caf4504 (diff)
downloadllvm-e6419d320d501077d1c5e1e7e1291a1ec6573877.zip
llvm-e6419d320d501077d1c5e1e7e1291a1ec6573877.tar.gz
llvm-e6419d320d501077d1c5e1e7e1291a1ec6573877.tar.bz2
[MC] [Win64EH] Fix builds with expensive checks enabled
This fixes a failed assert if expensive checks are enabled, since 1308bb99e06752ab0b5175c92da31083f91af921.
Diffstat (limited to 'llvm/lib/MC/MCWin64EH.cpp')
-rw-r--r--llvm/lib/MC/MCWin64EH.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp
index a585b50..8e8dba7 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