Changeset View
Standalone View
test/Transforms/LoopVectorize/pr28541.ll
- This file was added.
1 | ; RUN: opt -loop-vectorize -pass-remarks=loop-vectorize -S < %s 2>&1 | FileCheck %s | ||||
---|---|---|---|---|---|
2 | | ||||
anemet: Use -loop-vectorize rather than -O2. | |||||
Not Done ReplyWhy did you change from -pass-remaks-missed to -pass-remarks? I prefer positive checks over negative ones. I think that we also want to check the particular reason for failing to vectorize, so please also pass -pass-remarks-analysis=loop-vectorize and check for that string as well. anemet: Why did you change from -pass-remaks-missed to -pass-remarks? I prefer positive checks over… | |||||
Not Done Reply
See the comments for addAcyclicInnerLoop. timshen: > Why did you change from -pass-remaks-missed to -pass-remarks? I prefer positive checks over… | |||||
3 | ; FIXME: Check for -pass-remarks-missed and -pass-remarks-analysis output when | ||||
Done ReplyThen please add a FIXME about this. anemet: Then please add a FIXME about this. | |||||
4 | ; addAcyclicInnerLoop emits analysis. | ||||
Done ReplyCould you also please check that the loop doesn't get vectorized? mkuper: Could you also please check that the loop doesn't get vectorized? | |||||
Done Reply+1 and if you pass -pass-remarks-missed=loop-vectorize you can also check that the diag message is emitted correctly anemet: +1 and if you pass -pass-remarks-missed=loop-vectorize you can also check that the diag message… | |||||
5 | | ||||
6 | ; Check that opt does not crash on such input: | ||||
7 | ; | ||||
8 | ; a, b, c; | ||||
9 | ; fn1() { | ||||
10 | ; while (b--) { | ||||
11 | ; c = a; | ||||
12 | ; switch (a & 3) | ||||
13 | ; case 0: | ||||
14 | ; do | ||||
15 | ; case 3: | ||||
16 | ; case 2: | ||||
17 | ; case 1: | ||||
18 | ; ; | ||||
19 | ; while (--c) | ||||
20 | ; ; | ||||
21 | ; } | ||||
22 | ; } | ||||
23 | | ||||
24 | @b = common global i32 0, align 4 | ||||
25 | @a = common global i32 0, align 4 | ||||
26 | @c = common global i32 0, align 4 | ||||
Not Done ReplyThis doesn't look like it ought to work if you're only passing -loop-vectorize to opt. mkuper: This doesn't look like it ought to work if you're only passing -loop-vectorize to opt. | |||||
27 | | ||||
Not Done ReplySorry, ignore this, commented before the last change. :-) mkuper: Sorry, ignore this, commented before the last change. :-) | |||||
28 | ; CHECK-NOT: vectorized loop | ||||
29 | ; CHECK-LABEL: fn1 | ||||
30 | | ||||
31 | define i32 @fn1() { | ||||
32 | entry: | ||||
33 | %tmp2 = load i32, i32* @b, align 4 | ||||
34 | %dec3 = add nsw i32 %tmp2, -1 | ||||
35 | store i32 %dec3, i32* @b, align 4 | ||||
36 | %tobool4 = icmp eq i32 %tmp2, 0 | ||||
37 | br i1 %tobool4, label %while.end, label %while.body.lr.ph | ||||
38 | | ||||
39 | while.body.lr.ph: ; preds = %entry | ||||
40 | %tmp1 = load i32, i32* @a, align 4 | ||||
41 | %and = and i32 %tmp1, 3 | ||||
42 | %switch = icmp eq i32 %and, 0 | ||||
43 | br label %while.body | ||||
44 | | ||||
45 | while.cond: ; preds = %do.cond | ||||
46 | %dec = add nsw i32 %dec7, -1 | ||||
47 | %tobool = icmp eq i32 %dec7, 0 | ||||
48 | br i1 %tobool, label %while.cond.while.end_crit_edge, label %while.body | ||||
49 | | ||||
50 | while.body: ; preds = %while.body.lr.ph, %while.cond | ||||
51 | %dec7 = phi i32 [ %dec3, %while.body.lr.ph ], [ %dec, %while.cond ] | ||||
52 | br i1 %switch, label %do.body, label %do.cond | ||||
53 | | ||||
54 | do.body: ; preds = %do.cond, %while.body | ||||
55 | %dec25 = phi i32 [ %dec2, %do.cond ], [ %tmp1, %while.body ] | ||||
56 | br label %do.cond | ||||
57 | | ||||
58 | do.cond: ; preds = %do.body, %while.body | ||||
59 | %dec26 = phi i32 [ %dec25, %do.body ], [ %tmp1, %while.body ] | ||||
60 | %dec2 = add nsw i32 %dec26, -1 | ||||
61 | %tobool3 = icmp eq i32 %dec2, 0 | ||||
62 | br i1 %tobool3, label %while.cond, label %do.body | ||||
63 | | ||||
64 | while.cond.while.end_crit_edge: ; preds = %while.cond | ||||
65 | store i32 0, i32* @c, align 4 | ||||
66 | store i32 -1, i32* @b, align 4 | ||||
67 | br label %while.end | ||||
68 | | ||||
69 | while.end: ; preds = %while.cond.while.end_crit_edge, %entry | ||||
70 | ret i32 undef | ||||
71 | } |
Use -loop-vectorize rather than -O2.