[clang] [lld] [llvm] [WebAssembly] Enable nontrapping-fptoint and bulk-memory by default. (PR #112049)

Dan Gohman via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 15 18:06:00 PDT 2024


================
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %s -o %t.o
+; RUN: llc -filetype=obj -mattr=-bulk-memory %s -o %t.o
----------------
sunfishcode wrote:

I've now investigated custom-section-name.ll more.

With bulk-memory, we get a `__wasm_init_memory` function:
```
(module $custom-section-name.bss.wasm
  (type (;0;) (func))
  (import "env" "memory" (memory (;0;) 2))
  (func $__wasm_call_ctors (;0;) (type 0))
  (func $__wasm_init_memory (;1;) (type 0)
    i32.const 1036
    i32.const 0
    i32.const 4
    memory.fill
  )
  (global $__stack_pointer (;0;) (mut i32) i32.const 66576)
  (start $__wasm_init_memory)
  (data $WowZero! (;0;) (i32.const 1024) "\00\00\00\00")
  (data $MyAwesomeSection (;1;) (i32.const 1028) "*\00\00\00")
  (data $AnotherGreatSection (;2;) (i32.const 1032) "\07\00\00\00")
  (@custom "target_features" (after data) "\06+\0bbulk-memory+\16call-indirect-overlong+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext")
)
```
Without bulk-memory we get a .bss section:
```
(module $custom-section-name.bss.wasm
  (type (;0;) (func))
  (import "env" "memory" (memory (;0;) 2))
  (func $__wasm_call_ctors (;0;) (type 0))
  (global $__stack_pointer (;0;) (mut i32) i32.const 66576)
  (data $WowZero! (;0;) (i32.const 1024) "\00\00\00\00")
  (data $MyAwesomeSection (;1;) (i32.const 1028) "*\00\00\00")
  (data $AnotherGreatSection (;2;) (i32.const 1032) "\07\00\00\00")
  (data $.bss (;3;) (i32.const 1036) "\00\00\00\00")
  (@custom "target_features" (after data) "\05+\16call-indirect-overlong+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext")
)
```

The test is intended to test the use of the .bss section, and we only get a .bss section in this test if we disable bulk-memory.

https://github.com/llvm/llvm-project/pull/112049


More information about the cfe-commits mailing list