1 ; RUN: opt -S -passes=newgvn < %s | FileCheck %s
4 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"
5 target triple = "x86_64-apple-macosx10.8.0"
7 declare ptr @malloc(i64) nounwind allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc"
9 define noalias ptr @test1() nounwind uwtable ssp {
11 %call = tail call ptr @malloc(i64 100) nounwind
12 %0 = load i8, ptr %call, align 1
13 %tobool = icmp eq i8 %0, 0
14 br i1 %tobool, label %if.end, label %if.then
16 if.then: ; preds = %entry
17 store i8 0, ptr %call, align 1
20 if.end: ; preds = %if.then, %entry
23 ; CHECK-LABEL: @test1(
28 declare ptr @_Znwm(i64) nounwind
30 define noalias ptr @test2() nounwind uwtable ssp {
32 %call = tail call ptr @_Znwm(i64 100) nounwind
33 %0 = load i8, ptr %call, align 1
34 %tobool = icmp eq i8 %0, 0
35 br i1 %tobool, label %if.end, label %if.then
37 if.then: ; preds = %entry
38 store i8 0, ptr %call, align 1
41 if.end: ; preds = %if.then, %entry
44 ; CHECK-LABEL: @test2(
49 declare ptr @aligned_alloc(i64 allocalign, i64) nounwind allockind("alloc,uninitialized,aligned") allocsize(1) "alloc-family"="malloc"
51 define noalias ptr @test3() nounwind uwtable ssp {
53 %call = tail call ptr @aligned_alloc(i64 256, i64 32) nounwind
54 %0 = load i8, ptr %call, align 32
55 %tobool = icmp eq i8 %0, 0
56 br i1 %tobool, label %if.end, label %if.then
58 if.then: ; preds = %entry
59 store i8 0, ptr %call, align 1
62 if.end: ; preds = %if.then, %entry
65 ; CHECK-LABEL: @test3(