[WebAssembly] Don't perform the returned-argument optimization on constants.
[oota-llvm.git] / test / CodeGen / ARM / noreturn.ll
1 ; RUN: llc -O3 -o - %s | FileCheck %s
2 ; Test case from PR16882.
3 target triple = "thumbv7s-apple-ios"
4
5 define i32 @test1() {
6 ; CHECK-LABEL: @test1
7 ; CHECK-NOT: push
8 entry:
9   tail call void @overflow() #0
10   unreachable
11 }
12
13 ; Function Attrs: noreturn nounwind
14 declare void @overflow() #0
15
16 define i32 @test2(i32 %x, i32 %y) {
17 ; CHECK-LABEL: @test2
18 ; CHECK-NOT: push
19 ; CHECK-NOT: pop
20 entry:
21   %conv = sext i32 %x to i64
22   %conv1 = sext i32 %y to i64
23   %mul = mul nsw i64 %conv1, %conv
24   %conv2 = trunc i64 %mul to i32
25   %conv3 = sext i32 %conv2 to i64
26   %cmp = icmp eq i64 %mul, %conv3
27   br i1 %cmp, label %if.end, label %if.then
28
29 if.then:                                          ; preds = %entry
30   tail call void @overflow() #0
31   unreachable
32
33 if.end:                                           ; preds = %entry
34   ret i32 %conv2
35 }
36
37 ; Test case for PR17825.
38 define i32 @test3() {
39 ; CHECK-LABEL: @test3
40 ; CHECK: push
41 entry:
42   tail call void @overflow_with_unwind() #1
43   unreachable
44 }
45
46 ; Test case for uwtable
47 define i32 @test4() uwtable {
48 ; CHECK-LABEL: @test4
49 ; CHECK: push
50 entry:
51   tail call void @overflow() #0
52   unreachable
53 }
54
55 define i32 @test5() uwtable {
56 ; CHECK-LABEL: @test5
57 ; CHECK: push
58 entry:
59   tail call void @overflow_with_unwind() #1
60   unreachable
61 }
62
63 ; Function Attrs: noreturn
64 declare void @overflow_with_unwind() #1
65
66 attributes #0 = { noreturn nounwind }
67 attributes #1 = { noreturn }