diff options
| author | Michael Zolotukhin <mzolotukhin@apple.com> | 2016-05-26 21:42:51 +0000 |
|---|---|---|
| committer | Michael Zolotukhin <mzolotukhin@apple.com> | 2016-05-26 21:42:51 +0000 |
| commit | 1ecdedad8d839f5522aabbbdf6dd17541f9cf501 (patch) | |
| tree | f890649f2270f2fd88836af2074626f7291c16d0 /llvm/test | |
| parent | 7509d54b216924b592c1752eface9789f683d616 (diff) | |
| download | bcm5719-llvm-1ecdedad8d839f5522aabbbdf6dd17541f9cf501.tar.gz bcm5719-llvm-1ecdedad8d839f5522aabbbdf6dd17541f9cf501.zip | |
[LoopUnrollAnalyzer] Fix a crash in analyzeLoopUnrollCost.
Condition might be simplified to a Constant, but it doesn't have to be
ConstantInt, so we should dyn_cast, instead of cast.
This fixes PR27886.
llvm-svn: 270924
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/LoopUnroll/full-unroll-crashers.ll | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopUnroll/full-unroll-crashers.ll b/llvm/test/Transforms/LoopUnroll/full-unroll-crashers.ll index 54d4bbb82fc..00d12c289cc 100644 --- a/llvm/test/Transforms/LoopUnroll/full-unroll-crashers.ll +++ b/llvm/test/Transforms/LoopUnroll/full-unroll-crashers.ll @@ -137,3 +137,33 @@ for.body: exit: ret void } + +@i = external global i32, align 4 + +define void @folded_not_to_constantint() { +entry: + br label %for.body + +for.body: + %iv = phi i32 [ 0, %entry ], [ %inc, %for.inc ] + %m = phi i32* [ @i, %entry ], [ %m, %for.inc ] + br i1 undef, label %if.else, label %if.then + +if.then: + unreachable + +if.else: + %cmp = icmp ult i32* %m, null + br i1 %cmp, label %cond.false, label %for.inc + +cond.false: + unreachable + +for.inc: + %inc = add nuw nsw i32 %iv, 1 + %cmp2 = icmp ult i32 %inc, 10 + br i1 %cmp2, label %for.body, label %for.end + +for.end: + ret void +} |

