Update Polly tests to handle explicitly typed gep changes in LLVM
[polly-mirror.git] / test / Isl / CodeGen / LoopParallelMD / single_loop_param_parallel.ll
blob7f86462af3f793803c3b98641f5068c6ac998fba
1 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-codegen-isl -S < %s | FileCheck %s -check-prefix=SEQUENTIAL
2 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-codegen-isl -polly-ast-detect-parallel -S < %s | FileCheck %s -check-prefix=PARALLEL
3 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"
4 target triple = "x86_64-pc-linux-gnu"
6 ; This is a trivially parallel loop. We just use it to ensure that we actually
7 ; emit the right information.
9 ; for (i = 0; i < n; i++)
10 ;   A[i] = 1;
12 @A = common global [1024 x i32] zeroinitializer
13 define void @test-one(i64 %n) {
14 start:
15   fence seq_cst
16   br label %loop.header
18 loop.header:
19   %i = phi i64 [ 0, %start ], [ %i.next, %loop.backedge ]
20   %exitcond = icmp ne i64 %i, %n
21   br i1 %exitcond, label %loop.body, label %ret
23 loop.body:
24   %scevgep = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %i
25   store i32 1, i32* %scevgep
26   br label %loop.backedge
28 loop.backedge:
29   %i.next = add nsw i64 %i, 1
30   br label %loop.header
32 ret:
33   fence seq_cst
34   ret void
37 ; SEQUENTIAL: @test-one
38 ; SEQUENTIAL-NOT: !llvm.mem.parallel_loop_access
39 ; SEQUENTIAL-NOT: !llvm.loop
41 ; PARALLEL: @test-one
42 ; PARALLEL: store i32 1, i32* %scevgep1, {{[ ._!,a-zA-Z0-9]*}}, !llvm.mem.parallel_loop_access ![[LoopID:[0-9]*]]
43 ; PARALLEL:  br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit, !llvm.loop ![[LoopID]]
45 ; This loop has memory dependences that require at least a simple dependence
46 ; analysis to detect the parallelism.
48 ; for (i = 0; i < n; i++)
49 ;   A[2 * i] = A[2 * i + 1];
51 define void @test-two(i64 %n) {
52 start:
53   fence seq_cst
54   br label %loop.header
56 loop.header:
57   %i = phi i64 [ 0, %start ], [ %i.next, %loop.backedge ]
58   %exitcond = icmp ne i64 %i, %n
59   br i1 %exitcond, label %loop.body, label %ret
61 loop.body:
62   %loadoffset1 = mul nsw i64 %i, 2
63   %loadoffset2 = add nsw i64 %loadoffset1, 1
64   %scevgepload = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %loadoffset2
65   %val = load i32* %scevgepload
66   %storeoffset = mul i64 %i, 2
67   %scevgepstore = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %storeoffset
68   store i32 %val, i32* %scevgepstore
69   br label %loop.backedge
71 loop.backedge:
72   %i.next = add nsw i64 %i, 1
73   br label %loop.header
75 ret:
76   fence seq_cst
77   ret void
80 ; SEQUENTIAL: @test-two
81 ; SEQUENTIAL-NOT: !llvm.mem.parallel_loop_access
82 ; SEQUENTIAL-NOT: !llvm.loop
84 ; PARALLEL: @test-two
85 ; PARALLEL: %val_p_scalar_ = load i32* %scevgep, {{[ ._!,a-zA-Z0-9]*}}, !llvm.mem.parallel_loop_access ![[LoopID:[0-9]*]]
86 ; PARALLEL: store i32 %val_p_scalar_, i32* %scevgep1, {{[ ._!,a-zA-Z0-9]*}}, !llvm.mem.parallel_loop_access ![[LoopID]]
87 ; PARALLEL:  br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit, !llvm.loop ![[LoopID]]