Speculatively revert "DeadStoreElimination can now trim the size of a store if
[oota-llvm.git] / test / Transforms / EarlyCSE / basic.ll
index bc152e706241ec7694213ffdf6bd90bab6326fd8..57b1697ff4debcd40eef5b7c84a4bc975337831b 100644 (file)
@@ -13,21 +13,21 @@ define void @test1(i8 %V, i32 *%P) {
   volatile store i32 %C, i32* %P
   volatile store i32 %D, i32* %P
   ; CHECK-NEXT: %C = zext i8 %V to i32
-  ; CHECK-NEXT: volatile store i32 %C
-  ; CHECK-NEXT: volatile store i32 %C
+  ; CHECK-NEXT: store volatile i32 %C
+  ; CHECK-NEXT: store volatile i32 %C
   
   %E = add i32 %C, %C
   %F = add i32 %C, %C
   volatile store i32 %E, i32* %P
   volatile store i32 %F, i32* %P
   ; CHECK-NEXT: %E = add i32 %C, %C
-  ; CHECK-NEXT: volatile store i32 %E
-  ; CHECK-NEXT: volatile store i32 %E
+  ; CHECK-NEXT: store volatile i32 %E
+  ; CHECK-NEXT: store volatile i32 %E
 
   %G = add nuw i32 %C, %C         ;; not a CSE with E
   volatile store i32 %G, i32* %P
   ; CHECK-NEXT: %G = add nuw i32 %C, %C
-  ; CHECK-NEXT: volatile store i32 %G
+  ; CHECK-NEXT: store volatile i32 %G
   ret void
 }
 
@@ -106,3 +106,16 @@ define void @test7(i32 *%P) {
   ; CHECK-NEXT: store i32 45
   ; CHECK-NEXT: ret void
 }
+
+;; Readnone functions aren't invalidated by stores.
+; CHECK: @test8
+define i32 @test8(i32 *%P) {
+  %V1 = call i32 @func(i32* %P) readnone
+  store i32 4, i32* %P
+  %V2 = call i32 @func(i32* %P) readnone
+  %Diff = sub i32 %V1, %V2
+  ret i32 %Diff
+  ; CHECK: ret i32 0
+}
+
+