add a testcase for readonly call CSE
authorChris Lattner <sabre@nondot.org>
Mon, 3 Jan 2011 03:33:47 +0000 (03:33 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 3 Jan 2011 03:33:47 +0000 (03:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122730 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/EarlyCSE/basic.ll

index a761ef764c69bb7eb44c7f95ad1c6c68dbc90c5a..6d772599b3616d4e1397648f5d91b5304e047b38 100644 (file)
@@ -75,3 +75,15 @@ F:
   ; CHECK: F:
   ; CHECK: ret i32 %Diff
 }
+
+declare i32 @func(i32 *%P) readonly
+
+;; Simple call CSE'ing.
+; CHECK: @test5
+define i32 @test5(i32 *%P) {
+  %V1 = call i32 @func(i32* %P)
+  %V2 = call i32 @func(i32* %P)
+  %Diff = sub i32 %V1, %V2
+  ret i32 %Diff
+  ; CHECK: ret i32 0
+}