diff options
author | James Molloy <james.molloy@arm.com> | 2015-02-11 12:15:41 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2015-02-11 12:15:41 +0000 |
commit | 7c336576a5b90e6f6f041f521d37f780744057ce (patch) | |
tree | db2fccab0d8fc829cf3ff8ff1f1ae3f13b1f1be7 /llvm/test/Transforms | |
parent | a19216c8f4b26cb98aae5ada5c44c73bd3bf350e (diff) | |
download | bcm5719-llvm-7c336576a5b90e6f6f041f521d37f780744057ce.tar.gz bcm5719-llvm-7c336576a5b90e6f6f041f521d37f780744057ce.zip |
[SimplifyCFG] Swap to using TargetTransformInfo for cost
analysis.
We're already using TTI in SimplifyCFG, so remove the hard-baked "cheapness"
heuristic and use TTI directly. Generally NFC intended, but we're using a slightly
different heuristic now so there is a slight test churn.
Test changes:
* combine-comparisons-by-cse.ll: Removed unneeded branch check.
* 2014-08-04-muls-it.ll: Test now doesn't branch but emits muleq.
* coalesce-subregs.ll: Superfluous block check.
* 2008-01-02-hoist-fp-add.ll: fadd is safe to speculate. Change to udiv.
* PhiBlockMerge.ll: Superfluous CFG checking code. Main checks still present.
* select-gep.ll: A variable GEP is not expensive, just TCC_Basic, according to the TTI.
llvm-svn: 228826
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/SimplifyCFG/2008-01-02-hoist-fp-add.ll | 16 | ||||
-rw-r--r-- | llvm/test/Transforms/SimplifyCFG/PhiBlockMerge.ll | 4 | ||||
-rw-r--r-- | llvm/test/Transforms/SimplifyCFG/select-gep.ll | 23 |
3 files changed, 11 insertions, 32 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/2008-01-02-hoist-fp-add.ll b/llvm/test/Transforms/SimplifyCFG/2008-01-02-hoist-fp-add.ll index cf29b715979..8e156373998 100644 --- a/llvm/test/Transforms/SimplifyCFG/2008-01-02-hoist-fp-add.ll +++ b/llvm/test/Transforms/SimplifyCFG/2008-01-02-hoist-fp-add.ll @@ -1,27 +1,27 @@ -; The phi should not be eliminated in this case, because the fp op could trap. +; The phi should not be eliminated in this case, because the divide op could trap. ; RUN: opt < %s -simplifycfg -S | FileCheck %s target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i686-apple-darwin8" -@G = weak global double 0.000000e+00, align 8 ; <double*> [#uses=2] +@G = weak global i32 0, align 8 ; <i32*> [#uses=2] -define void @test(i32 %X, i32 %Y, double %Z) { +define void @test(i32 %X, i32 %Y, i32 %Z) { entry: %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - %tmp = load double* @G, align 8 ; <double> [#uses=2] + %tmp = load i32* @G, align 8 ; <i32> [#uses=2] %tmp3 = icmp eq i32 %X, %Y ; <i1> [#uses=1] %tmp34 = zext i1 %tmp3 to i8 ; <i8> [#uses=1] %toBool = icmp ne i8 %tmp34, 0 ; <i1> [#uses=1] br i1 %toBool, label %cond_true, label %cond_next cond_true: ; preds = %entry - %tmp7 = fadd double %tmp, %Z ; <double> [#uses=1] + %tmp7 = udiv i32 %tmp, %Z ; <i32> [#uses=1] br label %cond_next cond_next: ; preds = %cond_true, %entry -; CHECK: = phi double - %F.0 = phi double [ %tmp, %entry ], [ %tmp7, %cond_true ] ; <double> [#uses=1] - store double %F.0, double* @G, align 8 +; CHECK: = phi i32 + %F.0 = phi i32 [ %tmp, %entry ], [ %tmp7, %cond_true ] ; <i32> [#uses=1] + store i32 %F.0, i32* @G, align 8 ret void } diff --git a/llvm/test/Transforms/SimplifyCFG/PhiBlockMerge.ll b/llvm/test/Transforms/SimplifyCFG/PhiBlockMerge.ll index 36b52f52d49..555082921b9 100644 --- a/llvm/test/Transforms/SimplifyCFG/PhiBlockMerge.ll +++ b/llvm/test/Transforms/SimplifyCFG/PhiBlockMerge.ll @@ -4,9 +4,7 @@ ; define i32 @test(i1 %a, i1 %b) { -; CHECK: br i1 %a br i1 %a, label %M, label %O -; CHECK: O: O: ; preds = %0 ; CHECK: select i1 %b, i32 0, i32 1 ; CHECK-NOT: phi @@ -18,9 +16,9 @@ N: ; preds = %Q, %O %Wp = phi i32 [ 0, %O ], [ 1, %Q ] ; <i32> [#uses=1] br label %M M: ; preds = %N, %0 -; CHECK: %W = phi i32 %W = phi i32 [ %Wp, %N ], [ 2, %0 ] ; <i32> [#uses=1] %R = add i32 %W, 1 ; <i32> [#uses=1] ret i32 %R +; CHECK: ret } diff --git a/llvm/test/Transforms/SimplifyCFG/select-gep.ll b/llvm/test/Transforms/SimplifyCFG/select-gep.ll index 96c214cbc81..43e46ca7efc 100644 --- a/llvm/test/Transforms/SimplifyCFG/select-gep.ll +++ b/llvm/test/Transforms/SimplifyCFG/select-gep.ll @@ -1,27 +1,8 @@ ; RUN: opt -S -simplifycfg < %s | FileCheck %s -define i8* @test1(i8* %x, i64 %y) nounwind { -entry: - %tmp1 = load i8* %x, align 1 - %cmp = icmp eq i8 %tmp1, 47 - br i1 %cmp, label %if.then, label %if.end - -if.then: - %incdec.ptr = getelementptr inbounds i8* %x, i64 %y - br label %if.end - -if.end: - %x.addr = phi i8* [ %incdec.ptr, %if.then ], [ %x, %entry ] - ret i8* %x.addr - -; CHECK-LABEL: @test1( -; CHECK-NOT: select -; CHECK: ret i8* %x.addr -} - %ST = type { i8, i8 } -define i8* @test2(%ST* %x, i8* %y) nounwind { +define i8* @test1(%ST* %x, i8* %y) nounwind { entry: %cmp = icmp eq %ST* %x, null br i1 %cmp, label %if.then, label %if.end @@ -34,7 +15,7 @@ if.end: %x.addr = phi i8* [ %incdec.ptr, %if.then ], [ %y, %entry ] ret i8* %x.addr -; CHECK-LABEL: @test2( +; CHECK-LABEL: @test1( ; CHECK: %incdec.ptr.y = select i1 %cmp, i8* %incdec.ptr, i8* %y ; CHECK: ret i8* %incdec.ptr.y } |