diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-10-19 16:37:30 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-10-19 16:37:30 +0000 |
| commit | a225ed8d2b661a5ceb6f108930b3f889501d929f (patch) | |
| tree | 306f1ea72fc85f69106cf33df3fadaa1a32186e8 /llvm/test/Transforms/IndVarSimplify | |
| parent | 2afd661685aea4ce232ab67554f0aa3110317619 (diff) | |
| download | bcm5719-llvm-a225ed8d2b661a5ceb6f108930b3f889501d929f.tar.gz bcm5719-llvm-a225ed8d2b661a5ceb6f108930b3f889501d929f.zip | |
SCEVExpander: Don't crash when trying to merge two constant phis.
Just constant fold them so they can't cause any trouble. Fixes PR12627.
llvm-svn: 166286
Diffstat (limited to 'llvm/test/Transforms/IndVarSimplify')
| -rw-r--r-- | llvm/test/Transforms/IndVarSimplify/2012-10-19-congruent-constant.ll | 27 | ||||
| -rw-r--r-- | llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll | 1 |
2 files changed, 27 insertions, 1 deletions
diff --git a/llvm/test/Transforms/IndVarSimplify/2012-10-19-congruent-constant.ll b/llvm/test/Transforms/IndVarSimplify/2012-10-19-congruent-constant.ll new file mode 100644 index 00000000000..5c478669d29 --- /dev/null +++ b/llvm/test/Transforms/IndVarSimplify/2012-10-19-congruent-constant.ll @@ -0,0 +1,27 @@ +; RUN: opt -S -indvars < %s | FileCheck %s + +; PR12627 +define void @test1(i32 %x) nounwind uwtable ssp { +entry: + br label %for.body + +for.body: ; preds = %for.body, %entry + %phi1 = phi i1 [ false, %entry ], [ %cmpa, %for.body ] + %phi2 = phi i1 [ false, %entry ], [ %cmpb, %for.body ] + %i.07 = phi i32 [ 0, %entry ], [ %inc, %for.body ] + tail call void @aux(i1 %phi1, i1 %phi2) nounwind + %cmpa = icmp sgt i32 %i.07, 200 + %cmpb = icmp sgt i32 %i.07, 100 + %inc = add nsw i32 %i.07, 1 + %exitcond = icmp eq i32 %inc, 100 + br i1 %exitcond, label %for.end, label %for.body + +for.end: ; preds = %for.body + ret void + +; CHECK: @test1 +; CHECK-NOT: phi i1 +; CHECK: call void @aux(i1 false, i1 false) +} + +declare void @aux(i1, i1) diff --git a/llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll b/llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll index bfdd000e38e..507f695e67c 100644 --- a/llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll +++ b/llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll @@ -199,7 +199,6 @@ entry: ; back to the loop iv. ; ; CHECK: loop: -; CHECK: phi i32 ; CHECK-NOT: phi ; CHECK: exit: loop: |

