Changeset View
Changeset View
Standalone View
Standalone View
llvm/test/Transforms/Attributor/heap_to_stack.ll
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | define void @test1() { | ||||
ret void | ret void | ||||
} | } | ||||
; TEST 2 - negative, call to a sync function. | ; TEST 2 - negative, call to a sync function. | ||||
define void @test2() { | define void @test2() { | ||||
%1 = tail call noalias i8* @malloc(i64 4) | %1 = tail call noalias i8* @malloc(i64 4) | ||||
; CHECK: @malloc(i64 4) | ; CHECK: @malloc(i64 4) | ||||
; CHECK-NEXT: @sync_func(i8* %1) | ; CHECK-NEXT: @sync_func(i8* noalias %1) | ||||
tail call void @sync_func(i8* %1) | tail call void @sync_func(i8* %1) | ||||
tail call void @free(i8* %1) | tail call void @free(i8* %1) | ||||
ret void | ret void | ||||
} | } | ||||
; TEST 3 - 1 malloc, 1 free | ; TEST 3 - 1 malloc, 1 free | ||||
define void @test3() { | define void @test3() { | ||||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | define void @test7() { | ||||
ret void | ret void | ||||
} | } | ||||
; TEST 8 - Negative: bitcast pointer used in capture function | ; TEST 8 - Negative: bitcast pointer used in capture function | ||||
define void @test8() { | define void @test8() { | ||||
%1 = tail call noalias i8* @malloc(i64 4) | %1 = tail call noalias i8* @malloc(i64 4) | ||||
; CHECK: %1 = tail call noalias i8* @malloc(i64 4) | ; CHECK: %1 = tail call noalias i8* @malloc(i64 4) | ||||
; CHECK-NEXT: @no_sync_func(i8* nocapture nofree %1) | ; CHECK-NEXT: @no_sync_func(i8* noalias nocapture nofree %1) | ||||
tail call void @no_sync_func(i8* %1) | tail call void @no_sync_func(i8* %1) | ||||
%2 = bitcast i8* %1 to i32* | %2 = bitcast i8* %1 to i32* | ||||
store i32 10, i32* %2 | store i32 10, i32* %2 | ||||
%3 = load i32, i32* %2 | %3 = load i32, i32* %2 | ||||
tail call void @foo(i32* %2) | tail call void @foo(i32* %2) | ||||
; CHECK: @free(i8* %1) | ; CHECK: @free(i8* noalias nocapture %1) | ||||
tail call void @free(i8* %1) | tail call void @free(i8* %1) | ||||
ret void | ret void | ||||
} | } | ||||
; TEST 9 - FIXME: malloc should be converted. | ; TEST 9 - FIXME: malloc should be converted. | ||||
define void @test9() { | define void @test9() { | ||||
%1 = tail call noalias i8* @malloc(i64 4) | %1 = tail call noalias i8* @malloc(i64 4) | ||||
; CHECK: %1 = tail call noalias i8* @malloc(i64 4) | ; CHECK: %1 = tail call noalias i8* @malloc(i64 4) | ||||
; CHECK-NEXT: @no_sync_func(i8* nocapture nofree %1) | ; CHECK-NEXT: @no_sync_func(i8* noalias nocapture nofree %1) | ||||
tail call void @no_sync_func(i8* %1) | tail call void @no_sync_func(i8* %1) | ||||
%2 = bitcast i8* %1 to i32* | %2 = bitcast i8* %1 to i32* | ||||
store i32 10, i32* %2 | store i32 10, i32* %2 | ||||
%3 = load i32, i32* %2 | %3 = load i32, i32* %2 | ||||
tail call void @foo_nounw(i32* %2) | tail call void @foo_nounw(i32* %2) | ||||
; CHECK: @free(i8* %1) | ; CHECK: @free(i8* noalias nocapture %1) | ||||
tail call void @free(i8* %1) | tail call void @free(i8* %1) | ||||
ret void | ret void | ||||
} | } | ||||
; TEST 10 - 1 malloc, 1 free | ; TEST 10 - 1 malloc, 1 free | ||||
define i32 @test10() { | define i32 @test10() { | ||||
%1 = tail call noalias i8* @malloc(i64 4) | %1 = tail call noalias i8* @malloc(i64 4) | ||||
Show All 23 Lines | |||||
} | } | ||||
; TEST 11 | ; TEST 11 | ||||
define void @test11() { | define void @test11() { | ||||
%1 = tail call noalias i8* @malloc(i64 4) | %1 = tail call noalias i8* @malloc(i64 4) | ||||
; CHECK: test11 | ; CHECK: test11 | ||||
; CHECK-NEXT: alloc | ; CHECK-NEXT: alloc | ||||
; CHECK-NEXT: @sync_will_return(i8* %1) | ; CHECK-NEXT: @sync_will_return(i8* noalias %1) | ||||
tail call void @sync_will_return(i8* %1) | tail call void @sync_will_return(i8* %1) | ||||
tail call void @free(i8* %1) | tail call void @free(i8* %1) | ||||
ret void | ret void | ||||
} | } | ||||
; TEST 12 | ; TEST 12 | ||||
define i32 @irreducible_cfg(i32 %0) { | define i32 @irreducible_cfg(i32 %0) { | ||||
; CHECK: alloca i8, i64 4 | ; CHECK: alloca i8, i64 4 | ||||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |