llvm-project
37 строк · 1.0 Кб
1; RUN: opt %loadNPMPolly '-passes=print<polly-ast>' -polly-ast-detect-parallel -disable-output < %s | FileCheck %s
2;
3; CHECK: pragma simd reduction
4;
5; int prod;
6; void f() {
7; for (int i = 0; i < 100; i++)
8; prod *= i;
9; }
10;
11target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
12
13@prod = common global i32 0, align 4
14
15define void @f() {
16entry:
17br label %for.cond
18
19for.cond: ; preds = %for.inc, %entry
20%i1.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
21%exitcond = icmp ne i32 %i1.0, 100
22br i1 %exitcond, label %for.body, label %for.end
23
24for.body: ; preds = %for.cond
25%add2 = add nsw i32 %i1.0, 3
26%tmp1 = load i32, ptr @prod, align 4
27%mul3 = mul nsw i32 %tmp1, %add2
28store i32 %mul3, ptr @prod, align 4
29br label %for.inc
30
31for.inc: ; preds = %for.body
32%inc = add nsw i32 %i1.0, 1
33br label %for.cond
34
35for.end: ; preds = %for.cond
36ret void
37}
38