llvm-project
32 строки · 770.0 Байт
1; RUN: opt %loadNPMPolly \
2; RUN: -passes=polly-codegen -S < %s | FileCheck %s
3
4; This test ensures that the expression N + 1 that is stored in the phi-node
5; alloca, is directly computed and not incorrectly transfered through memory.
6
7; CHECK: store i64 [[REG:%.*]], ptr %res.phiops
8; CHECK: [[REG]] = add i64 %N, 1
9
10define i64 @foo(ptr %A, i64 %N) {
11entry:
12br label %next
13
14next:
15%cond = icmp eq i64 %N, 0
16br i1 %cond, label %loop, label %merge
17
18loop:
19%indvar = phi i64 [0, %next], [%indvar.next, %loop]
20%indvar.next = add i64 %indvar, 1
21%sum = add i64 %N, 1
22store float 4.0, ptr %A
23%cmp = icmp sle i64 %indvar.next, 100
24br i1 %cmp, label %loop, label %merge
25
26merge:
27%res = phi i64 [%sum, %loop], [0, %next]
28br label %exit
29
30exit:
31ret i64 %res
32}
33