Files
clang-p2996/polly/test/ScopDetect/phi_with_multi_exiting_edges.ll
Michael Kruse 5c02808131 [polly] Introduce -polly-print-* passes to replace -analyze.
The `opt -analyze` option only works with the legacy pass manager and might be removed in the future, as explained in llvm.org/PR53733. This patch introduced -polly-print-* passes that print what the pass would print with the `-analyze` option and replaces all uses of `-analyze` in the regression tests.

There are two exceptions: `CodeGen\single_loop_param_less_equal.ll` and `CodeGen\loop_with_condition_nested.ll` use `-analyze on the `-loops` pass which is not part of Polly.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D120782
2022-03-14 10:27:15 -05:00

65 lines
2.2 KiB
LLVM

; RUN: opt %loadPolly -polly-print-detect -disable-output < %s | FileCheck %s
;
; Region with an exit node that has a PHI node multiple incoming edges from
; inside the region. Motivation for supporting such cases in Polly.
;
; float test(long n, float A[static const restrict n]) {
; float sum = 0;
; for (long i = 0; i < n; i += 1)
; sum += A[i];
; for (long i = 0; i < n; i += 1)
; sum += A[i];
; return sum;
; }
;
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define float @test(i64 %n, float* noalias nonnull %A) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%sum.0 = phi float [ 0.000000e+00, %entry ], [ %add, %for.inc ]
%i.0 = phi i64 [ 0, %entry ], [ %add1, %for.inc ]
%cmp = icmp slt i64 %i.0, %n
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
br label %for.inc
for.inc: ; preds = %for.body
%arrayidx = getelementptr inbounds float, float* %A, i64 %i.0
%tmp = load float, float* %arrayidx, align 4
%add = fadd float %sum.0, %tmp
%add1 = add nuw nsw i64 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
%sum.0.lcssa = phi float [ %sum.0, %for.cond ]
br label %for.cond.3
for.cond.3: ; preds = %for.inc.8, %for.end
%sum.1 = phi float [ %sum.0.lcssa, %for.end ], [ %add7, %for.inc.8 ]
%i2.0 = phi i64 [ 0, %for.end ], [ %add9, %for.inc.8 ]
%cmp4 = icmp slt i64 %i2.0, %n
br i1 %cmp4, label %for.body.5, label %for.end.10
for.body.5: ; preds = %for.cond.3
br label %for.inc.8
for.inc.8: ; preds = %for.body.5
%arrayidx6 = getelementptr inbounds float, float* %A, i64 %i2.0
%tmp1 = load float, float* %arrayidx6, align 4
%add7 = fadd float %sum.1, %tmp1
%add9 = add nuw nsw i64 %i2.0, 1
br label %for.cond.3
for.end.10: ; preds = %for.cond.3
%sum.1.lcssa = phi float [ %sum.1, %for.cond.3 ]
ret float %sum.1.lcssa
}
; CHECK: Valid Region for Scop: for.cond => for.end.10