llvm-project/polly/test/ScopInfo/granularity_scalar-indep.ll

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

69 lines
2.3 KiB
LLVM
Raw Normal View History

; RUN: opt %loadPolly -polly-stmt-granularity=scalar-indep -polly-print-instructions -polly-scops -analyze < %s | FileCheck %s -match-full-lines
;
; Split a block into two independent statements that share no scalar.
; This case has the instructions of the two statements interleaved, such that
; splitting the BasicBlock in the middle would cause a scalar dependency.
;
; for (int j = 0; j < n; j += 1) {
; body:
; double valA = A[0];
; double valB = 21.0 + 21.0;
; A[0] = valA;
; B[0] = valB;
; }
;
define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit
body:
%valA = load double, double* %A
%valB = fadd double 21.0, 21.0
store double %valA, double* %A
store double %valB, double* %B
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for
exit:
br label %return
return:
ret void
}
; CHECK: Statements {
; CHECK-NEXT: Stmt_body
; CHECK-NEXT: Domain :=
; CHECK-NEXT: [n] -> { Stmt_body[i0] : 0 <= i0 < n };
; CHECK-NEXT: Schedule :=
; CHECK-NEXT: [n] -> { Stmt_body[i0] -> [i0, 0] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
; CHECK-NEXT: Instructions {
Infer alignment of unmarked loads in IR/bitcode parsing. For IR generated by a compiler, this is really simple: you just take the datalayout from the beginning of the file, and apply it to all the IR later in the file. For optimization testcases that don't care about the datalayout, this is also really simple: we just use the default datalayout. The complexity here comes from the fact that some LLVM tools allow overriding the datalayout: some tools have an explicit flag for this, some tools will infer a datalayout based on the code generation target. Supporting this properly required plumbing through a bunch of new machinery: we want to allow overriding the datalayout after the datalayout is parsed from the file, but before we use any information from it. Therefore, IR/bitcode parsing now has a callback to allow tools to compute the datalayout at the appropriate time. Not sure if I covered all the LLVM tools that want to use the callback. (clang? lli? Misc IR manipulation tools like llvm-link?). But this is at least enough for all the LLVM regression tests, and IR without a datalayout is not something frontends should generate. This change had some sort of weird effects for certain CodeGen regression tests: if the datalayout is overridden with a datalayout with a different program or stack address space, we now parse IR based on the overridden datalayout, instead of the one written in the file (or the default one, if none is specified). This broke a few AVR tests, and one AMDGPU test. Outside the CodeGen tests I mentioned, the test changes are all just fixing CHECK lines and moving around datalayout lines in weird places. Differential Revision: https://reviews.llvm.org/D78403
2020-05-15 03:59:45 +08:00
; CHECK-NEXT: %valA = load double, double* %A, align 8
2020-05-16 06:15:09 +08:00
; CHECK-NEXT: store double %valA, double* %A, align 8
; CHECK-NEXT: }
; CHECK-NEXT: Stmt_body_b
; CHECK-NEXT: Domain :=
; CHECK-NEXT: [n] -> { Stmt_body_b[i0] : 0 <= i0 < n };
; CHECK-NEXT: Schedule :=
; CHECK-NEXT: [n] -> { Stmt_body_b[i0] -> [i0, 1] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [n] -> { Stmt_body_b[i0] -> MemRef_B[0] };
; CHECK-NEXT: Instructions {
; CHECK-NEXT: %valB = fadd double 2.100000e+01, 2.100000e+01
2020-05-16 06:15:09 +08:00
; CHECK-NEXT: store double %valB, double* %B, align 8
; CHECK-NEXT: }
; CHECK-NEXT: }