summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Analysis/GlobalsModRef/func-memattributes.ll24
-rw-r--r--llvm/test/Transforms/DeadStoreElimination/free.ll6
-rw-r--r--llvm/test/Transforms/DeadStoreElimination/simple.ll23
3 files changed, 38 insertions, 15 deletions
diff --git a/llvm/test/Analysis/GlobalsModRef/func-memattributes.ll b/llvm/test/Analysis/GlobalsModRef/func-memattributes.ll
index 5494512592e..c1c26911873 100644
--- a/llvm/test/Analysis/GlobalsModRef/func-memattributes.ll
+++ b/llvm/test/Analysis/GlobalsModRef/func-memattributes.ll
@@ -2,30 +2,30 @@
@X = internal global i32 4
-define void @test0() {
+define i32 @test0() {
; CHECK-LABEL: @test0
; CHECK: store i32 0, i32* @X
-; CHECK-NEXT: call void @func_readonly() #0
+; CHECK-NEXT: call i32 @func_readonly() #0
; CHECK-NEXT: store i32 1, i32* @X
store i32 0, i32* @X
- call void @func_readonly() #0
+ %x = call i32 @func_readonly() #0
store i32 1, i32* @X
- ret void
+ ret i32 %x
}
-define void @test1() {
+define i32 @test1() {
; CHECK-LABEL: @test1
; CHECK-NOT: store
-; CHECK: call void @func_read_argmem_only() #1
+; CHECK: call i32 @func_read_argmem_only() #1
; CHECK-NEXT: store i32 3, i32* @X
store i32 2, i32* @X
- call void @func_read_argmem_only() #1
+ %x = call i32 @func_read_argmem_only() #1
store i32 3, i32* @X
- ret void
+ ret i32 %x
}
-declare void @func_readonly() #0
-declare void @func_read_argmem_only() #1
+declare i32 @func_readonly() #0
+declare i32 @func_read_argmem_only() #1
-attributes #0 = { readonly }
-attributes #1 = { readonly argmemonly }
+attributes #0 = { readonly nounwind }
+attributes #1 = { readonly argmemonly nounwind }
diff --git a/llvm/test/Transforms/DeadStoreElimination/free.ll b/llvm/test/Transforms/DeadStoreElimination/free.ll
index 6b69ec86020..5cfe7263c0b 100644
--- a/llvm/test/Transforms/DeadStoreElimination/free.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/free.ll
@@ -13,7 +13,7 @@ define void @test(i32* %Q, i32* %P) {
%DEAD = load i32, i32* %Q ; <i32> [#uses=1]
store i32 %DEAD, i32* %P
%1 = bitcast i32* %P to i8*
- tail call void @free(i8* %1)
+ tail call void @free(i8* %1) nounwind
ret void
}
@@ -25,7 +25,7 @@ define void @test2({i32, i32}* %P) {
%Q = getelementptr {i32, i32}, {i32, i32} *%P, i32 0, i32 1
store i32 4, i32* %Q
%1 = bitcast {i32, i32}* %P to i8*
- tail call void @free(i8* %1)
+ tail call void @free(i8* %1) nounwind
ret void
}
@@ -37,7 +37,7 @@ define void @test3() {
store i8 0, i8* %m
%m1 = getelementptr i8, i8* %m, i64 1
store i8 1, i8* %m1
- call void @free(i8* %m)
+ call void @free(i8* %m) nounwind
ret void
}
diff --git a/llvm/test/Transforms/DeadStoreElimination/simple.ll b/llvm/test/Transforms/DeadStoreElimination/simple.ll
index 193add112f6..4ed27ebfd66 100644
--- a/llvm/test/Transforms/DeadStoreElimination/simple.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/simple.ll
@@ -498,3 +498,26 @@ bb3:
ret i32 0
}
+; Don't remove redundant store: unknown_func could unwind
+; CHECK-LABEL: @test34(
+; CHECK: store i32 1
+; CHECK: store i32 0
+; CHECK: ret
+define void @test34(i32* noalias %p) {
+ store i32 1, i32* %p
+ call void @unknown_func()
+ store i32 0, i32* %p
+ ret void
+}
+
+; Remove redundant store even with an unwinding function in the same block
+; CHECK-LABEL: @test35(
+; CHECK: call void @unknown_func
+; CHECK-NEXT: store i32 0
+; CHECK-NEXT: ret void
+define void @test35(i32* noalias %p) {
+ call void @unknown_func()
+ store i32 1, i32* %p
+ store i32 0, i32* %p
+ ret void
+}
OpenPOWER on IntegriCloud