[PATCH] D58799: [WebAssembly] Fix crash when @llvm.global_dtors is external
Thomas Lively via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 28 16:12:38 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL355157: [WebAssembly] Fix crash when @llvm.global_dtors is external (authored by tlively, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D58799?vs=188804&id=188806#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58799/new/
https://reviews.llvm.org/D58799
Files:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp
llvm/trunk/test/CodeGen/WebAssembly/global_dtors.ll
Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp
@@ -61,7 +61,7 @@
LLVM_DEBUG(dbgs() << "********** Lower Global Destructors **********\n");
GlobalVariable *GV = M.getGlobalVariable("llvm.global_dtors");
- if (!GV)
+ if (!GV || !GV->hasInitializer())
return false;
const ConstantArray *InitList = dyn_cast<ConstantArray>(GV->getInitializer());
Index: llvm/trunk/test/CodeGen/WebAssembly/global_dtors.ll
===================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/global_dtors.ll
+++ llvm/trunk/test/CodeGen/WebAssembly/global_dtors.ll
@@ -0,0 +1,9 @@
+; RUN: llc < %s
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+; Check that we do not crash when attempting to lower away
+; global_dtors without a definition.
+
+ at llvm.global_dtors = external global [2 x { i32, void ()*, i8* }]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58799.188806.patch
Type: text/x-patch
Size: 1137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190301/0b7a10ed/attachment.bin>
More information about the llvm-commits
mailing list