xref: /llvm-project/polly/test/Simplify/out-of-scop-use-in-region-entry-phi-node.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=print<polly-function-scops>,scop(print<polly-simplify>)' -disable-output < %s 2>&1 | FileCheck %s
2;
3; %tmp5 must keep the Value WRITE MemoryAccess, because as an incoming value of
4; %tmp4, it is an "external use".
5;
6; A common mistake is to assume that %tmp5 is used by %tmp4 in bb3, when
7; practically it's the incoming block %bb9 which is the user.
8;
9target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
10
11define void @hoge() {
12bb:
13  br label %bb2
14
15bb2:                                              ; preds = %bb
16  %tmp = load ptr, ptr undef
17  br label %bb3
18
19bb3:                                              ; preds = %bb9, %bb2
20  %tmp4 = phi ptr [ %tmp, %bb2 ], [ %tmp5, %bb9 ]
21  %tmp5 = getelementptr inbounds i64, ptr %tmp4, i64 1
22  %tmp6 = load i64, ptr %tmp5
23  %tmp7 = and i64 %tmp6, 4160749568
24  br i1 false, label %bb8, label %bb9
25
26bb8:                                              ; preds = %bb3
27  br label %bb9
28
29bb9:                                              ; preds = %bb8, %bb3
30  %tmp10 = icmp eq i64 %tmp7, 134217728
31  br i1 %tmp10, label %bb11, label %bb3
32
33bb11:                                             ; preds = %bb9
34  br label %bb12
35
36bb12:                                             ; preds = %bb11
37  ret void
38}
39
40
41; CHECK:      MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]
42; CHECK-NEXT:     [p_0] -> { Stmt_bb3[] -> MemRef_tmp5[] };
43
44; CHECK: SCoP could not be simplified
45