xref: /llvm-project/polly/test/CodeGen/entry_with_trivial_phi.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1*e1f056f6Srahulana-quic; RUN: opt %loadNPMPolly -passes=polly-codegen -S < %s
235f70200SMichael Kruse;
335f70200SMichael Kruse; The entry of this scop's simple region (entry.split => for.end) has an trivial
435f70200SMichael Kruse; PHI node. LCSSA may create such PHI nodes. This is a breakdown of this case in
535f70200SMichael Kruse; the function 'Laguerre_With_Deflation' of oggenc from LLVM's test-suite.
635f70200SMichael Kruse;
735f70200SMichael Krusetarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
835f70200SMichael Kruse
9b332499aSNikita Popovdefine void @test(i64 %n, ptr noalias nonnull %A, float %a) {
1035f70200SMichael Kruseentry:
1135f70200SMichael Kruse  br label %entry.split
1235f70200SMichael Kruse
1335f70200SMichael Kruse; CHECK-LABEL: %polly.split_new_and_old
14b332499aSNikita Popov; CHECK-NEXT:    store float %a, ptr %b.phiops
1535f70200SMichael Kruse
1635f70200SMichael Kruse; CHECK-LABEL: polly.stmt.entry.split
17b332499aSNikita Popov; CHECK-NEXT:    %b.phiops.reload = load float, ptr %b.phiops
1835f70200SMichael Kruse
1935f70200SMichael Kruseentry.split:
2035f70200SMichael Kruse  %b = phi float [ %a, %entry ]
21b332499aSNikita Popov  store float %b, ptr %A, align 4
2235f70200SMichael Kruse  %cmp2 = icmp slt i64 %n, 5
2335f70200SMichael Kruse  br i1 %cmp2, label %for.cond, label %for.end
2435f70200SMichael Kruse
2535f70200SMichael Krusefor.cond:                                         ; preds = %for.inc, %entry
2635f70200SMichael Kruse  %i.0 = phi i64 [ 0, %entry.split ], [ %add, %for.inc ]
2735f70200SMichael Kruse  %cmp = icmp slt i64 %i.0, %n
2835f70200SMichael Kruse  br i1 %cmp, label %for.body, label %for.end
2935f70200SMichael Kruse
3035f70200SMichael Krusefor.body:                                         ; preds = %for.cond
31b332499aSNikita Popov  %arrayidx = getelementptr inbounds float, ptr %A, i64 %i.0
32b332499aSNikita Popov  store float %a, ptr %arrayidx, align 4
3335f70200SMichael Kruse  br label %for.inc
3435f70200SMichael Kruse
3535f70200SMichael Krusefor.inc:                                          ; preds = %for.body
3635f70200SMichael Kruse  %add = add nuw nsw i64 %i.0, 1
3735f70200SMichael Kruse  br label %for.cond
3835f70200SMichael Kruse
3935f70200SMichael Krusefor.end:                                          ; preds = %for.cond
4035f70200SMichael Kruse  ret void
4135f70200SMichael Kruse}
42