blob: c91b6e17f79df7eacc6276bbe1584f916235d99a [file] [log] [blame]
Davide Italiano7e274e02016-12-22 16:03:48 +00001; XFAIL: *
2; RUN: opt -S -basicaa -newgvn < %s | FileCheck %s
3; RUN: opt -S -basicaa -newgvn -disable-simplify-libcalls < %s | FileCheck %s -check-prefix=CHECK_NO_LIBCALLS
4; PR13694
5
6target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
7target triple = "x86_64-apple-macosx10.8.0"
8
9declare i8* @malloc(i64) nounwind
10
11define noalias i8* @test1() nounwind uwtable ssp {
12entry:
13 %call = tail call i8* @malloc(i64 100) nounwind
14 %0 = load i8, i8* %call, align 1
15 %tobool = icmp eq i8 %0, 0
16 br i1 %tobool, label %if.end, label %if.then
17
18if.then: ; preds = %entry
19 store i8 0, i8* %call, align 1
20 br label %if.end
21
22if.end: ; preds = %if.then, %entry
23 ret i8* %call
24
25; CHECK-LABEL: @test1(
26; CHECK-NOT: load
27; CHECK-NOT: icmp
28
29; CHECK_NO_LIBCALLS-LABEL: @test1(
30; CHECK_NO_LIBCALLS: load
31; CHECK_NO_LIBCALLS: icmp
32}
33
34declare i8* @_Znwm(i64) nounwind
35
36define noalias i8* @test2() nounwind uwtable ssp {
37entry:
38 %call = tail call i8* @_Znwm(i64 100) nounwind
39 %0 = load i8, i8* %call, align 1
40 %tobool = icmp eq i8 %0, 0
41 br i1 %tobool, label %if.end, label %if.then
42
43if.then: ; preds = %entry
44 store i8 0, i8* %call, align 1
45 br label %if.end
46
47if.end: ; preds = %if.then, %entry
48 ret i8* %call
49
50; CHECK-LABEL: @test2(
51; CHECK-NOT: load
52; CHECK-NOT: icmp
53
54; CHECK_NO_LIBCALLS-LABEL: @test2(
55; CHECK_NO_LIBCALLS: load
56; CHECK_NO_LIBCALLS: icmp
57}