[PATCH] D35090: [WebAssembly] Use the correct size for MCFillFragment

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 11:37:01 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL307565: [WebAssembly] Use the correct size for MCFillFragment (authored by sbc).

Changed prior to commit:
  https://reviews.llvm.org/D35090?vs=105538&id=105891#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35090

Files:
  llvm/trunk/lib/MC/WasmObjectWriter.cpp
  llvm/trunk/test/MC/WebAssembly/array-fill.ll


Index: llvm/trunk/test/MC/WebAssembly/array-fill.ll
===================================================================
--- llvm/trunk/test/MC/WebAssembly/array-fill.ll
+++ llvm/trunk/test/MC/WebAssembly/array-fill.ll
@@ -0,0 +1,14 @@
+; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s
+; PR33624
+
+source_filename = "ws.c"
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown-wasm"
+
+%struct.bd = type { i8 }
+
+ at gBd = hidden global [2 x %struct.bd] [%struct.bd { i8 1 }, %struct.bd { i8 2 }], align 1
+
+; CHECK:  - Type:            DATA
+; CHECK:        Content:         '0102'
+; CHECK:    DataSize:        2
Index: llvm/trunk/lib/MC/WasmObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/MC/WasmObjectWriter.cpp
+++ llvm/trunk/lib/MC/WasmObjectWriter.cpp
@@ -1197,7 +1197,7 @@
                                                  Align->getMaxBytesToEmit());
           DataBytes.resize(Size, Value);
         } else if (auto *Fill = dyn_cast<MCFillFragment>(&Frag)) {
-          DataBytes.insert(DataBytes.end(), Size, Fill->getValue());
+          DataBytes.insert(DataBytes.end(), Fill->getSize(), Fill->getValue());
         } else {
           const auto &DataFrag = cast<MCDataFragment>(Frag);
           const SmallVectorImpl<char> &Contents = DataFrag.getContents();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35090.105891.patch
Type: text/x-patch
Size: 1385 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170710/ec43e905/attachment.bin>


More information about the llvm-commits mailing list