1
; RUN: opt -S -basicaa -gvn < %s | FileCheck %s
2
; RUN: opt -S -basicaa -gvn -disable-simplify-libcalls < %s | FileCheck %s -check-prefix=CHECK_NO_LIBCALLS
5
target 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"
6
target triple = "x86_64-apple-macosx10.8.0"
8
declare i8* @malloc(i64) nounwind
10
define noalias i8* @test1() nounwind uwtable ssp {
12
%call = tail call i8* @malloc(i64 100) nounwind
13
%0 = load i8, i8* %call, align 1
14
%tobool = icmp eq i8 %0, 0
15
br i1 %tobool, label %if.end, label %if.then
17
if.then: ; preds = %entry
18
store i8 0, i8* %call, align 1
21
if.end: ; preds = %if.then, %entry
24
; CHECK-LABEL: @test1(
28
; CHECK_NO_LIBCALLS-LABEL: @test1(
29
; CHECK_NO_LIBCALLS: load
30
; CHECK_NO_LIBCALLS: icmp
33
declare i8* @_Znwm(i64) nounwind
35
define noalias i8* @test2() nounwind uwtable ssp {
37
%call = tail call i8* @_Znwm(i64 100) nounwind
38
%0 = load i8, i8* %call, align 1
39
%tobool = icmp eq i8 %0, 0
40
br i1 %tobool, label %if.end, label %if.then
42
if.then: ; preds = %entry
43
store i8 0, i8* %call, align 1
46
if.end: ; preds = %if.then, %entry
49
; CHECK-LABEL: @test2(
53
; CHECK_NO_LIBCALLS-LABEL: @test2(
54
; CHECK_NO_LIBCALLS: load
55
; CHECK_NO_LIBCALLS: icmp