[PATCH] D60232: [WebAssembly] EmscriptenEHSjLj: Don't abort if __THREW__ is defined

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 3 18:41:47 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL357665: [WebAssembly] EmscriptenEHSjLj: Don't abort if __THREW__ is defined (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D60232?vs=193596&id=193642#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D60232

Files:
  llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp


Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -334,11 +334,12 @@
 // which will generate an import and asssumes that it will exist at link time.
 static GlobalVariable *getGlobalVariableI32(Module &M, IRBuilder<> &IRB,
                                             const char *Name) {
-  if (M.getNamedGlobal(Name))
-    report_fatal_error(Twine("variable name is reserved: ") + Name);
 
-  return new GlobalVariable(M, IRB.getInt32Ty(), false,
-                            GlobalValue::ExternalLinkage, nullptr, Name);
+  auto* GV = dyn_cast<GlobalVariable>(M.getOrInsertGlobal(Name, IRB.getInt32Ty()));
+  if (!GV)
+    report_fatal_error(Twine("unable to create global: ") + Name);
+
+  return GV;
 }
 
 // Simple function name mangler.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60232.193642.patch
Type: text/x-patch
Size: 992 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190404/445d6f45/attachment.bin>


More information about the llvm-commits mailing list