From d707c37072195e1e05edd8765b3f4bd79955b154 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 9 Jan 2018 22:48:37 +0000 Subject: Use a MCExpr for the size of MCFillFragment. This allows the size to be found during ralaxation. This fixes pr35858. llvm-svn: 322131 --- llvm/lib/MC/WasmObjectWriter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/MC/WasmObjectWriter.cpp') diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp index 782479e2651..37b12c63be4 100644 --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -528,7 +528,10 @@ static void addData(SmallVectorImpl &DataBytes, Align->getMaxBytesToEmit()); DataBytes.resize(Size, Value); } else if (auto *Fill = dyn_cast(&Frag)) { - DataBytes.insert(DataBytes.end(), Fill->getSize(), Fill->getValue()); + int64_t Size; + if (!Fill->getSize().evaluateAsAbsolute(Size)) + llvm_unreachable("The fill should be an assembler constant"); + DataBytes.insert(DataBytes.end(), Size, Fill->getValue()); } else { const auto &DataFrag = cast(Frag); const SmallVectorImpl &Contents = DataFrag.getContents(); -- cgit v1.2.3