1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=indvars,loop-idiom < %s
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 define i32 @quote_arg() nounwind {
11 for.cond: ; preds = %for.inc, %entry
12 %backslashes.0 = phi i32 [ undef, %entry ], [ %backslashes.2, %for.inc ]
13 %p.0 = phi ptr [ undef, %entry ], [ %incdec.ptr3, %for.inc ]
14 %q.0 = phi ptr [ undef, %entry ], [ %q.2, %for.inc ]
15 %0 = load i8, ptr %p.0, align 1
16 switch i8 %0, label %while.cond.preheader [
17 i8 0, label %for.cond4.preheader
21 while.cond.preheader: ; preds = %for.cond
22 %tobool210 = icmp eq i32 %backslashes.0, 0
23 br i1 %tobool210, label %for.inc.loopexit, label %while.body.lr.ph
25 while.body.lr.ph: ; preds = %while.cond.preheader
26 %1 = add i32 %backslashes.0, -1
27 %2 = zext i32 %1 to i64
30 for.cond4.preheader: ; preds = %for.cond
31 %tobool57 = icmp eq i32 %backslashes.0, 0
32 br i1 %tobool57, label %for.end10, label %for.body6.lr.ph
34 for.body6.lr.ph: ; preds = %for.cond4.preheader
37 while.body: ; preds = %while.body.lr.ph, %while.body
38 %q.112 = phi ptr [ %q.0, %while.body.lr.ph ], [ %incdec.ptr, %while.body ]
39 %backslashes.111 = phi i32 [ %backslashes.0, %while.body.lr.ph ], [ %dec, %while.body ]
40 %incdec.ptr = getelementptr inbounds i8, ptr %q.112, i64 1
41 store i8 92, ptr %incdec.ptr, align 1
42 %dec = add nsw i32 %backslashes.111, -1
43 %tobool2 = icmp eq i32 %dec, 0
44 br i1 %tobool2, label %while.cond.for.inc.loopexit_crit_edge, label %while.body
46 while.cond.for.inc.loopexit_crit_edge: ; preds = %while.body
47 %scevgep.sum = add i64 %2, 1
48 %scevgep13 = getelementptr i8, ptr %q.0, i64 %scevgep.sum
49 br label %for.inc.loopexit
51 for.inc.loopexit: ; preds = %while.cond.for.inc.loopexit_crit_edge, %while.cond.preheader
52 %q.1.lcssa = phi ptr [ %scevgep13, %while.cond.for.inc.loopexit_crit_edge ], [ %q.0, %while.cond.preheader ]
55 for.inc: ; preds = %for.inc.loopexit, %for.cond
56 %backslashes.2 = phi i32 [ %backslashes.0, %for.cond ], [ 0, %for.inc.loopexit ]
57 %q.2 = phi ptr [ %q.0, %for.cond ], [ %q.1.lcssa, %for.inc.loopexit ]
58 %incdec.ptr3 = getelementptr inbounds i8, ptr %p.0, i64 1
61 for.body6: ; preds = %for.body6.lr.ph, %for.body6
62 %q.39 = phi ptr [ %q.0, %for.body6.lr.ph ], [ %incdec.ptr7, %for.body6 ]
63 %backslashes.38 = phi i32 [ %backslashes.0, %for.body6.lr.ph ], [ %dec9, %for.body6 ]
64 %incdec.ptr7 = getelementptr inbounds i8, ptr %q.39, i64 1
65 store i8 92, ptr %incdec.ptr7, align 1
66 %dec9 = add nsw i32 %backslashes.38, -1
67 %tobool5 = icmp eq i32 %dec9, 0
68 br i1 %tobool5, label %for.cond4.for.end10_crit_edge, label %for.body6
70 for.cond4.for.end10_crit_edge: ; preds = %for.body6
73 for.end10: ; preds = %for.cond4.for.end10_crit_edge, %for.cond4.preheader