1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -S -passes=gvn 2>&1 | 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"
5 target triple = "x86_64-apple-darwin10.0"
7 declare noalias ptr @malloc(i64) nounwind allockind("alloc,uninitialized") allocsize(0) inaccessiblememonly
8 declare noalias ptr @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0,1) inaccessiblememonly
9 declare noalias ptr @_Znwm(i64)
10 declare void @escape(ptr)
12 define i8 @test_malloc(ptr %p) {
13 ; CHECK-LABEL: @test_malloc(
14 ; CHECK-NEXT: [[OBJ:%.*]] = call ptr @malloc(i64 16)
15 ; CHECK-NEXT: call void @escape(ptr [[OBJ]])
16 ; CHECK-NEXT: ret i8 0
19 %obj = call ptr @malloc(i64 16)
21 %sub = sub i8 %v1, %v2
22 call void @escape(ptr %obj)
26 define i8 @test_calloc(ptr %p) {
27 ; CHECK-LABEL: @test_calloc(
28 ; CHECK-NEXT: [[OBJ:%.*]] = call ptr @calloc(i64 1, i64 16)
29 ; CHECK-NEXT: call void @escape(ptr [[OBJ]])
30 ; CHECK-NEXT: ret i8 0
33 %obj = call ptr @calloc(i64 1, i64 16)
35 %sub = sub i8 %v1, %v2
36 call void @escape(ptr %obj)
40 define i8 @test_opnew(ptr %p) {
41 ; CHECK-LABEL: @test_opnew(
42 ; CHECK-NEXT: [[OBJ:%.*]] = call ptr @_Znwm(i64 16)
43 ; CHECK-NEXT: call void @escape(ptr [[OBJ]])
44 ; CHECK-NEXT: ret i8 0
47 %obj = call ptr @_Znwm(i64 16)
49 %sub = sub i8 %v1, %v2
50 call void @escape(ptr %obj)