diff options
author | Owen Anderson <resistor@mac.com> | 2009-05-31 09:03:40 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-05-31 09:03:40 +0000 |
commit | 88554df4a2b801a11964a2668acfac2d68ab14bc (patch) | |
tree | 770d0403fca2d8b54038a4e6c98eea379cbd776a /test/Transforms | |
parent | 88b7293f49b6f341e5f672c4bb24d7be17bc4a1f (diff) | |
download | external_llvm-88554df4a2b801a11964a2668acfac2d68ab14bc.zip external_llvm-88554df4a2b801a11964a2668acfac2d68ab14bc.tar.gz external_llvm-88554df4a2b801a11964a2668acfac2d68ab14bc.tar.bz2 |
Be more aggressive in doing LoadPRE by tracing backwards when a block only has
a single predecessor.
Patch by Jakub Staszak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/GVN/pre-single-pred.ll | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/Transforms/GVN/pre-single-pred.ll b/test/Transforms/GVN/pre-single-pred.ll new file mode 100644 index 0000000..b735ea9 --- /dev/null +++ b/test/Transforms/GVN/pre-single-pred.ll @@ -0,0 +1,32 @@ +; RUN: llvm-as < %s | opt -gvn -enable-load-pre | llvm-dis | not grep {tmp3 = load} + +define i32 @f(i32* nocapture %p, i32 %n) nounwind { +entry: + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %i.0 = phi i32 [ 0, %entry ], [ %indvar.next, %for.inc ] ; <i32> [#uses=2] + %cmp = icmp slt i32 %i.0, %n ; <i1> [#uses=1] + br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge + +for.cond.for.end_crit_edge: ; preds = %for.cond + br label %for.end + +for.body: ; preds = %for.cond + %tmp3 = load i32* %p ; <i32> [#uses=1] + %dec = add i32 %tmp3, -1 ; <i32> [#uses=2] + store i32 %dec, i32* %p + %cmp6 = icmp slt i32 %dec, 0 ; <i1> [#uses=1] + br i1 %cmp6, label %for.body.for.end_crit_edge, label %for.inc + +for.body.for.end_crit_edge: ; preds = %for.body + br label %for.end + +for.inc: ; preds = %for.body + %indvar.next = add i32 %i.0, 1 ; <i32> [#uses=1] + br label %for.cond + +for.end: ; preds = %for.body.for.end_crit_edge, %for.cond.for.end_crit_edge + %tmp9 = load i32* %p ; <i32> [#uses=1] + ret i32 %tmp9 +} |