[DSE] Don't remove stores made live by a call which unwinds.

Issue exposed by noalias or more aggressive alias analysis.

Fixes http://llvm.org/PR25422.

Differential revision: https://reviews.llvm.org/D21007

llvm-svn: 278451
diff --git a/llvm/test/Analysis/GlobalsModRef/func-memattributes.ll b/llvm/test/Analysis/GlobalsModRef/func-memattributes.ll
index 5494512..c1c2691 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 }