Andrew Trick | 7fa4e0f | 2012-05-19 00:48:25 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -iv-users -S -disable-output |
Chandler Carruth | 0952750 | 2017-01-15 09:29:27 +0000 | [diff] [blame] | 2 | ; RUN: opt < %s -passes='require<ivusers>' -S -disable-output |
Andrew Trick | 7fa4e0f | 2012-05-19 00:48:25 +0000 | [diff] [blame] | 3 | ; |
| 4 | ; PR12868: Infinite recursion: |
| 5 | ; getUDivExpr()->getZeroExtendExpr()->isLoopBackedgeGuardedBy() |
| 6 | ; |
| 7 | ; We actually want SCEV simplification to fail gracefully in this |
Alp Toker | cb40291 | 2014-01-24 17:20:08 +0000 | [diff] [blame] | 8 | ; case, so there's no output to check, just the absence of stack overflow. |
Andrew Trick | 7fa4e0f | 2012-05-19 00:48:25 +0000 | [diff] [blame] | 9 | |
| 10 | @c = common global i8 0, align 1 |
| 11 | |
| 12 | define i32 @func() { |
| 13 | entry: |
| 14 | br label %for.cond |
| 15 | |
| 16 | for.cond: ; preds = %for.body, %entry |
| 17 | %storemerge = phi i8 [ -1, %entry ], [ %inc, %for.body ] |
| 18 | %ui.0 = phi i32 [ undef, %entry ], [ %div, %for.body ] |
| 19 | %tobool = icmp eq i8 %storemerge, 0 |
| 20 | br i1 %tobool, label %for.end, label %for.body |
| 21 | |
| 22 | for.body: ; preds = %for.cond |
| 23 | %conv = sext i8 %storemerge to i32 |
| 24 | %div = lshr i32 %conv, 1 |
| 25 | %tobool2 = icmp eq i32 %div, 0 |
| 26 | %inc = add i8 %storemerge, 1 |
| 27 | br i1 %tobool2, label %for.cond, label %for.end |
| 28 | |
| 29 | for.end: ; preds = %for.body, %for.cond |
| 30 | ret i32 0 |
| 31 | } |