From db3311edc7ed4e6171f268a1f1967f0f65aac457 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 2 Nov 2009 02:00:18 +0000 Subject: [PATCH] merge a test into store.ll llvm-svn: 85771 --- .../Transforms/InstCombine/store-merge.ll | 37 --------------- llvm/test/Transforms/InstCombine/store.ll | 45 +++++++++++++++++++ 2 files changed, 45 insertions(+), 37 deletions(-) delete mode 100644 llvm/test/Transforms/InstCombine/store-merge.ll diff --git a/llvm/test/Transforms/InstCombine/store-merge.ll b/llvm/test/Transforms/InstCombine/store-merge.ll deleted file mode 100644 index 06d497d10dbf..000000000000 --- a/llvm/test/Transforms/InstCombine/store-merge.ll +++ /dev/null @@ -1,37 +0,0 @@ -; RUN: opt < %s -instcombine -S | \ -; RUN: grep {ret i32 %.toremerge} | count 2 -;; Simple sinking tests - -; "if then else" -define i32 @test1(i1 %C) { - %A = alloca i32 - br i1 %C, label %Cond, label %Cond2 - -Cond: - store i32 -987654321, i32* %A - br label %Cont - -Cond2: - store i32 47, i32* %A - br label %Cont - -Cont: - %V = load i32* %A - ret i32 %V -} - -; "if then" -define i32 @test2(i1 %C) { - %A = alloca i32 - store i32 47, i32* %A - br i1 %C, label %Cond, label %Cont - -Cond: - store i32 -987654321, i32* %A - br label %Cont - -Cont: - %V = load i32* %A - ret i32 %V -} - diff --git a/llvm/test/Transforms/InstCombine/store.ll b/llvm/test/Transforms/InstCombine/store.ll index 3b8c0ab3030d..54f162131784 100644 --- a/llvm/test/Transforms/InstCombine/store.ll +++ b/llvm/test/Transforms/InstCombine/store.ll @@ -19,3 +19,48 @@ define void @test2(i32* %P) { ; CHECK-NEXT: ret void } +;; Simple sinking tests + +; "if then else" +define i32 @test3(i1 %C) { + %A = alloca i32 + br i1 %C, label %Cond, label %Cond2 + +Cond: + store i32 -987654321, i32* %A + br label %Cont + +Cond2: + store i32 47, i32* %A + br label %Cont + +Cont: + %V = load i32* %A + ret i32 %V +; CHECK: @test3 +; CHECK-NOT: alloca +; CHECK: Cont: +; CHECK-NEXT: %storemerge = phi i32 [ 47, %Cond2 ], [ -987654321, %Cond ] +; CHECK-NEXT: ret i32 %storemerge +} + +; "if then" +define i32 @test4(i1 %C) { + %A = alloca i32 + store i32 47, i32* %A + br i1 %C, label %Cond, label %Cont + +Cond: + store i32 -987654321, i32* %A + br label %Cont + +Cont: + %V = load i32* %A + ret i32 %V +; CHECK: @test4 +; CHECK-NOT: alloca +; CHECK: Cont: +; CHECK-NEXT: %storemerge = phi i32 [ -987654321, %Cond ], [ 47, %0 ] +; CHECK-NEXT: ret i32 %storemerge +} +