[lld] ff8e0ed - [lld][WebAssembly] Fix memory.fill argument in 64-bit mode

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 03:11:19 PST 2023


Author: Sam Clegg
Date: 2023-01-10T03:11:05-08:00
New Revision: ff8e0ed9308c45d23572f0726abf652b295de56b

URL: https://github.com/llvm/llvm-project/commit/ff8e0ed9308c45d23572f0726abf652b295de56b
DIFF: https://github.com/llvm/llvm-project/commit/ff8e0ed9308c45d23572f0726abf652b295de56b.diff

LOG: [lld][WebAssembly] Fix memory.fill argument in 64-bit mode

This only effects folks building with wasm64 + shared memory which
is not currently a supported configuration in emscripten or any other
wasm toolchain.

Differential Revision: https://reviews.llvm.org/D141005

Added: 
    

Modified: 
    lld/test/wasm/data-segments.ll
    lld/wasm/Writer.cpp

Removed: 
    


################################################################################
diff  --git a/lld/test/wasm/data-segments.ll b/lld/test/wasm/data-segments.ll
index cc97698552e9f..7ff949794d8e9 100644
--- a/lld/test/wasm/data-segments.ll
+++ b/lld/test/wasm/data-segments.ll
@@ -222,7 +222,7 @@
 ; PIC-DIS-NEXT:        global.get      1
 ; PIC-DIS-NEXT:        [[PTR]].add
 ; DIS-NEXT:            i32.const       0
-; DIS-NEXT:            i32.const       10000
+; DIS-NEXT:            [[PTR]].const   10000
 ; DIS-NEXT:            memory.fill     0
 
 ; NOPIC-DIS-NEXT:      [[PTR]].const   11064

diff  --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index 06bf458305637..36005037cd17e 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -1226,7 +1226,7 @@ void Writer::createInitMemoryFunction() {
 
         if (s->isBss) {
           writeI32Const(os, 0, "fill value");
-          writeI32Const(os, s->size, "memory region size");
+          writePtrConst(os, s->size, is64, "memory region size");
           writeU8(os, WASM_OPCODE_MISC_PREFIX, "bulk-memory prefix");
           writeUleb128(os, WASM_OPCODE_MEMORY_FILL, "memory.fill");
           writeU8(os, 0, "memory index immediate");


        


More information about the llvm-commits mailing list