1; RUN: llvm-as -o %t.o %s
2; RUN: wasm-ld -o %t0 -e main --lto-O0 %t.o
3; RUN: obj2yaml %t0 | FileCheck --check-prefix=CHECK-O0 %s
4; RUN: wasm-ld -o %t2 -e main --lto-O2 %t.o
5; RUN: obj2yaml %t2 | FileCheck --check-prefix=CHECK-O2 %s
6; RUN: wasm-ld -o %t2a -e main %t.o
7; RUN: obj2yaml %t2a | FileCheck --check-prefix=CHECK-O2 %s
8
9; Reject invalid optimization levels.
10; RUN: not wasm-ld -o %t3 -e main --lto-O6 %t.o 2>&1 | \
11; RUN:   FileCheck --check-prefix=INVALID %s
12; INVALID: invalid optimization level for LTO: 6
13
14; RUN: not wasm-ld -o %t3 -e main --lto-O-1 %t.o 2>&1 | \
15; RUN:   FileCheck --check-prefix=INVALIDNEGATIVE %s
16; INVALIDNEGATIVE: invalid optimization level for LTO: 4294967295
17
18target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
19target triple = "wasm32-unknown-unknown-wasm"
20
21; CHECK-O0: Name: foo
22; CHECK-O2-NOT: Name: foo
23define internal void @foo() {
24  ret void
25}
26
27define void @main() {
28  call void @foo()
29  ret void
30}
31