1 ; RUN: opt %loadPolly -disable-output -polly-invariant-load-hoisting \
2 ; RUN: -polly-allow-dereference-of-all-function-parameters \
3 ; RUN: -polly-print-scops < %s | FileCheck %s --check-prefix=SCOP
5 ; RUN: opt %loadPolly -S -polly-invariant-load-hoisting \
6 ; RUN: -polly-codegen < %s | FileCheck %s --check-prefix=CODE-RTC
9 ; RUN: opt %loadPolly -S -polly-invariant-load-hoisting \
10 ; RUN: -polly-allow-dereference-of-all-function-parameters \
11 ; RUN: -polly-codegen < %s | FileCheck %s --check-prefix=CODE
13 ; SCOP: Function: hoge
14 ; SCOP-NEXT: Region: %bb15---%bb37
15 ; SCOP-NEXT: Max Loop Depth: 2
16 ; SCOP-NEXT: Invariant Accesses: {
17 ; SCOP-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
18 ; SCOP-NEXT: [tmp, tmp17, tmp28] -> { Stmt_bb29[i0] -> MemRef_arg1[0] };
19 ; SCOP-NEXT: Execution Context: [tmp, tmp17, tmp28] -> { : }
20 ; SCOP-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
21 ; SCOP-NEXT: [tmp, tmp17, tmp28] -> { Stmt_bb27[] -> MemRef_arg[0] };
22 ; SCOP-NEXT: Execution Context: [tmp, tmp17, tmp28] -> { : }
25 ; Check that without the option `-polly-allow-dereference-of-all-function-parameters`
26 ; we do generate the runtime check.
27 ; CODE-RTC: polly.preload.cond: ; preds = %polly.preload.begin
28 ; CODE-RTC-NEXT: br i1 %{{[a-zA-Z0-9\.]*}}, label %polly.preload.exec, label %polly.preload.merge
30 ; Check that we don't generate a runtime check because we treat all
31 ; parameters as dereferencable.
32 ; CODE-NOT: polly.preload.cond: ; preds = %polly.preload.begin
33 ; CODE-NOT: br i1 %{{r1:[a-zA-Z0-9]*}}, label %polly.preload.exec, label %polly.preload.merge
35 target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
36 target triple = "x86_64-unknown-linux-gnu"
38 @global = external global i32
40 ; Function Attrs: nounwind uwtable
41 define void @hoge(ptr noalias %arg, ptr noalias %arg1, ptr noalias %arg2, ptr %A) #0 {
43 %tmp = load i32, ptr @global, align 4
44 %tmp3 = icmp sgt i32 %tmp, 1
51 br i1 %tmp3, label %bb16, label %bb27
54 %tmp17 = load i32, ptr %arg1, align 4
57 bb18: ; preds = %bb18, %bb16
58 %tmp19 = phi i32 [ %tmp25, %bb18 ], [ 1, %bb16 ]
59 %tmp20 = sext i32 %tmp19 to i64
60 %tmp21 = add nsw i64 %tmp20, -1
61 %tmp22 = getelementptr [0 x double], ptr %arg2, i64 0, i64 %tmp21
62 store i64 undef, ptr %tmp22, align 8
63 %tmp24 = icmp eq i32 %tmp19, %tmp17
64 %tmp25 = add i32 %tmp19, 1
65 br i1 %tmp24, label %bb26, label %bb18
70 bb27: ; preds = %bb26, %bb15
71 %tmp28 = load i32, ptr %arg, align 4
72 store float 42.0, ptr %A
75 bb29: ; preds = %bb35, %bb27
76 %tmp30 = load i32, ptr %arg1, align 4
77 store float 42.0, ptr %A
80 bb31: ; preds = %bb31, %bb29
81 %tmp32 = phi i32 [ 1, %bb31 ], [ 1, %bb29 ]
82 store float 42.0, ptr %A
83 %tmp33 = icmp eq i32 %tmp32, %tmp30
84 br i1 %tmp33, label %bb34, label %bb31
90 %tmp36 = icmp eq i32 0, %tmp28
91 br i1 %tmp36, label %bb37, label %bb29
97 attributes #0 = { nounwind uwtable }