From 2639f77252f8702d120412ec42bfb5ab66738462 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 15 Jul 2014 00:07:27 +0000 Subject: [PATCH] Convert test to FileCheck. Check the individual test functions for more useful failure errors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213021 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/load.ll | 48 +++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/test/Transforms/InstCombine/load.ll b/test/Transforms/InstCombine/load.ll index d11e08e10de..c8ce70a5c03 100644 --- a/test/Transforms/InstCombine/load.ll +++ b/test/Transforms/InstCombine/load.ll @@ -1,6 +1,7 @@ +; RUN: opt -instcombine -S < %s | FileCheck %s + ; This test makes sure that these instructions are properly eliminated. -; -; RUN: opt < %s -instcombine -S | not grep load + @X = constant i32 42 ; [#uses=2] @X2 = constant i32 47 ; [#uses=1] @@ -10,47 +11,63 @@ @GLOBAL = internal constant [4 x i32] zeroinitializer +; CHECK-LABEL: @test1( +; CHECK-NOT: load define i32 @test1() { %B = load i32* @X ; [#uses=1] ret i32 %B } +; CHECK-LABEL: @test2( +; CHECK-NOT: load define float @test2() { %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 1, i32 1 ; [#uses=1] %B = load float* %A ; [#uses=1] ret float %B } +; CHECK-LABEL: @test3( +; CHECK-NOT: load define i32 @test3() { %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 0, i32 0 ; [#uses=1] %B = load i32* %A ; [#uses=1] ret i32 %B } +; CHECK-LABEL: @test4( +; CHECK-NOT: load define i32 @test4() { %A = getelementptr [2 x { i32, float }]* @Z, i64 0, i64 1, i32 0 ; [#uses=1] %B = load i32* %A ; [#uses=1] ret i32 %B } +; CHECK-LABEL: @test5( +; CHECK-NOT: load define i32 @test5(i1 %C) { %Y = select i1 %C, i32* @X, i32* @X2 ; [#uses=1] %Z = load i32* %Y ; [#uses=1] ret i32 %Z } +; CHECK-LABEL: @test7( +; CHECK-NOT: load define i32 @test7(i32 %X) { %V = getelementptr i32* null, i32 %X ; [#uses=1] %R = load i32* %V ; [#uses=1] ret i32 %R } +; CHECK-LABEL: @test8( +; CHECK-NOT: load define i32 @test8(i32* %P) { store i32 1, i32* %P %X = load i32* %P ; [#uses=1] ret i32 %X } +; CHECK-LABEL: @test9( +; CHECK-NOT: load define i32 @test9(i32* %P) { %X = load i32* %P ; [#uses=1] %Y = load i32* %P ; [#uses=1] @@ -58,6 +75,8 @@ define i32 @test9(i32* %P) { ret i32 %Z } +; CHECK-LABEL: @test10( +; CHECK-NOT: load define i32 @test10(i1 %C.upgrd.1, i32* %P, i32* %Q) { br i1 %C.upgrd.1, label %T, label %F T: ; preds = %0 @@ -72,6 +91,8 @@ C: ; preds = %F, %T ret i32 %V } +; CHECK-LABEL: @test11( +; CHECK-NOT: load define double @test11(double* %p) { %t0 = getelementptr double* %p, i32 1 store double 2.0, double* %t0 @@ -80,19 +101,20 @@ define double @test11(double* %p) { ret double %x } +; CHECK-LABEL: @test12( +; CHECK-NOT: load define i32 @test12(i32* %P) { - %A = alloca i32 - store i32 123, i32* %A - ; Cast the result of the load not the source - %Q = bitcast i32* %A to i32* - %V = load i32* %Q - ret i32 %V + %A = alloca i32 + store i32 123, i32* %A + ; Cast the result of the load not the source + %Q = bitcast i32* %A to i32* + %V = load i32* %Q + ret i32 %V } +; CHECK-LABEL: @test13( +; CHECK-NOT: load define <16 x i8> @test13(<2 x i64> %x) { -entry: - %tmp = load <16 x i8> * bitcast ([4 x i32]* @GLOBAL to <16 x i8>*) - ret <16 x i8> %tmp + %tmp = load <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*) + ret <16 x i8> %tmp } - - -- 2.34.1