[ScopInfo] Do not use LLVM names to identify statements, arrays, and parameters
LLVM-IR names are commonly available in debug builds, but often not in release
builds. Hence, using LLVM-IR names to identify statements or memory reference
results makes the behavior of Polly depend on the compile mode. This is
undesirable. Hence, we now just number the statements instead of using LLVM-IR
names to identify them (this issue has previously been brought up by Zino
Benaissa).
However, as LLVM-IR names help in making test cases more readable, we add an
option '-polly-use-llvm-names' to still use LLVM-IR names. This flag is by
default set in the polly tests to make test cases more readable.
This change reduces the time in ScopInfo from 32 seconds to 2 seconds for the
following test case provided by Eli Friedman <efriedma@codeaurora.org> (already
used in one of the previous commits):
struct X { int x; };
void a();
#define SIG (int x, X **y, X **z)
typedef void (*fn)SIG;
#define FN { for (int i = 0; i < x; ++i) { (*y)[i].x += (*z)[i].x; } a(); }
#define FN5 FN FN FN FN FN
#define FN25 FN5 FN5 FN5 FN5
#define FN125 FN25 FN25 FN25 FN25 FN25
#define FN250 FN125 FN125
#define FN1250 FN250 FN250 FN250 FN250 FN250
void x SIG { FN1250 }
For a larger benchmark I have on-hand (10000 loops), this reduces the time for
running -polly-scops from 5 minutes to 4 minutes, a reduction by 20%.
The reason for this large speedup is that our previous use of printAsOperand
had a quadratic cost, as for each printed and unnamed operand the full function
was scanned to find the instruction number that identifies the operand.
We do not need to adjust the way memory reference ids are constructured, as
they do not use LLVM values.
Reviewed by: efriedma
Tags: #polly
Differential Revision: https://reviews.llvm.org/D32789
llvm-svn: 302072
2017-05-04 04:08:52 +08:00
|
|
|
; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
|
|
|
|
|
|
|
|
; This test case verifies that we generate numbered statement names in case
|
|
|
|
; no LLVM-IR names are used in the test case. We also verify, that we
|
|
|
|
; distinguish statements named with a number and unnamed statements that happen
|
|
|
|
; to have an index identical to a number used in a statement name.
|
|
|
|
|
|
|
|
; CHECK: Arrays {
|
|
|
|
; CHECK-NEXT: float MemRef0[*][%n]; // Element size 4
|
|
|
|
; CHECK-NEXT: float MemRef1[*][%n]; // Element size 4
|
|
|
|
; CHECK-NEXT: }
|
|
|
|
; CHECK-NEXT: Arrays (Bounds as pw_affs) {
|
|
|
|
; CHECK-NEXT: float MemRef0[*][ [n] -> { [] -> [(n)] } ]; // Element size 4
|
|
|
|
; CHECK-NEXT: float MemRef1[*][ [n] -> { [] -> [(n)] } ]; // Element size 4
|
|
|
|
; CHECK-NEXT: }
|
|
|
|
|
|
|
|
; CHECK: Statements {
|
|
|
|
; CHECK-NEXT: Stmt2
|
|
|
|
; CHECK-NEXT: Domain :=
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt2[i0, i1] : 0 <= i0 < n and 0 <= i1 < n };
|
|
|
|
; CHECK-NEXT: Schedule :=
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt2[i0, i1] -> [0, i0, i1, 0] };
|
|
|
|
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt2[i0, i1] -> MemRef0[i0, i1] };
|
|
|
|
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt2[i0, i1] -> MemRef1[i0, i1] };
|
|
|
|
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt2[i0, i1] -> MemRef1[i0, i1] };
|
|
|
|
; CHECK-NEXT: Stmt10
|
|
|
|
; CHECK-NEXT: Domain :=
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt10[i0, i1] : 0 <= i0 < n and 0 <= i1 < n };
|
|
|
|
; CHECK-NEXT: Schedule :=
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt10[i0, i1] -> [1, i0, i1, 0] };
|
|
|
|
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt10[i0, i1] -> MemRef1[i0, i1] };
|
|
|
|
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt10[i0, i1] -> MemRef0[i0, i1] };
|
|
|
|
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt10[i0, i1] -> MemRef0[i0, i1] };
|
|
|
|
; CHECK-NEXT: Stmt_2
|
|
|
|
; CHECK-NEXT: Domain :=
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt_2[i0, i1] : 0 <= i0 < n and 0 <= i1 < n };
|
|
|
|
; CHECK-NEXT: Schedule :=
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt_2[i0, i1] -> [1, i0, i1, 1] };
|
|
|
|
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
|
|
|
|
; CHECK-NEXT: [n] -> { Stmt_2[i0, i1] -> MemRef0[i0, i1]
|
|
|
|
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
define void @vec3(i64 %n, float*, float*) #0 {
|
|
|
|
br label %.split
|
|
|
|
|
|
|
|
.split: ; preds = %0
|
|
|
|
br label %.preheader2.lr.ph
|
|
|
|
|
|
|
|
.preheader2.lr.ph: ; preds = %.split
|
|
|
|
br label %.preheader2
|
|
|
|
|
|
|
|
.preheader2: ; preds = %.preheader2.lr.ph, %15
|
|
|
|
%i.010 = phi i64 [ 0, %.preheader2.lr.ph ], [ %16, %15 ]
|
|
|
|
br label %.lr.ph8
|
|
|
|
|
|
|
|
.lr.ph8: ; preds = %.preheader2
|
|
|
|
br label %4
|
|
|
|
|
|
|
|
..preheader1_crit_edge: ; preds = %15
|
|
|
|
br label %.preheader1
|
|
|
|
|
|
|
|
.preheader1: ; preds = %..preheader1_crit_edge, %.split
|
|
|
|
%3 = icmp sgt i64 %n, 0
|
|
|
|
br i1 %3, label %.preheader.lr.ph, label %"name"
|
|
|
|
|
|
|
|
.preheader.lr.ph: ; preds = %.preheader1
|
|
|
|
br label %.preheader
|
|
|
|
|
|
|
|
; <label>:4: ; preds = %.lr.ph8, %4
|
|
|
|
%j.07 = phi i64 [ 0, %.lr.ph8 ], [ %14, %4 ]
|
|
|
|
%5 = mul nsw i64 %i.010, %n
|
|
|
|
%6 = getelementptr inbounds float, float* %1, i64 %5
|
|
|
|
%7 = getelementptr inbounds float, float* %6, i64 %j.07
|
|
|
|
%8 = load float, float* %7, align 4
|
|
|
|
%9 = mul nsw i64 %i.010, %n
|
|
|
|
%10 = getelementptr inbounds float, float* %0, i64 %9
|
|
|
|
%11 = getelementptr inbounds float, float* %10, i64 %j.07
|
|
|
|
%12 = load float, float* %11, align 4
|
|
|
|
%13 = fadd float %8, %12
|
|
|
|
store float %13, float* %11, align 4
|
|
|
|
%14 = add nuw nsw i64 %j.07, 1
|
|
|
|
%exitcond13 = icmp ne i64 %14, %n
|
|
|
|
br i1 %exitcond13, label %4, label %._crit_edge9
|
|
|
|
|
|
|
|
._crit_edge9: ; preds = %4
|
|
|
|
br label %15
|
|
|
|
|
|
|
|
; <label>:15: ; preds = %._crit_edge9, %.preheader2
|
|
|
|
%16 = add nuw nsw i64 %i.010, 1
|
|
|
|
%exitcond14 = icmp ne i64 %16, %n
|
|
|
|
br i1 %exitcond14, label %.preheader2, label %..preheader1_crit_edge
|
|
|
|
|
|
|
|
.preheader: ; preds = %.preheader.lr.ph, %29
|
|
|
|
%i1.04 = phi i64 [ 0, %.preheader.lr.ph ], [ %30, %29 ]
|
|
|
|
%17 = icmp sgt i64 %n, 0
|
|
|
|
br i1 %17, label %.lr.ph, label %29
|
|
|
|
|
|
|
|
.lr.ph: ; preds = %.preheader
|
|
|
|
br label %18
|
|
|
|
|
|
|
|
; <label>:18: ; preds = %.lr.ph, %18
|
|
|
|
%j2.03 = phi i64 [ 0, %.lr.ph ], [ %28, %"2" ]
|
|
|
|
%19 = mul nsw i64 %i1.04, %n
|
|
|
|
%20 = getelementptr inbounds float, float* %0, i64 %19
|
|
|
|
%21 = getelementptr inbounds float, float* %20, i64 %j2.03
|
|
|
|
%22 = load float, float* %21, align 4
|
|
|
|
%23 = mul nsw i64 %i1.04, %n
|
|
|
|
%24 = getelementptr inbounds float, float* %1, i64 %23
|
|
|
|
%25 = getelementptr inbounds float, float* %24, i64 %j2.03
|
|
|
|
%26 = load float, float* %25, align 4
|
|
|
|
%27 = fadd float %22, %26
|
|
|
|
store float %27, float* %25, align 4
|
|
|
|
br label %"2"
|
|
|
|
|
|
|
|
"2":
|
|
|
|
store float 42.0, float* %25
|
|
|
|
%28 = add nuw nsw i64 %j2.03, 1
|
|
|
|
%exitcond = icmp ne i64 %28, %n
|
|
|
|
br i1 %exitcond, label %18, label %._crit_edge
|
|
|
|
|
|
|
|
._crit_edge: ; preds = %18
|
|
|
|
br label %29
|
|
|
|
|
|
|
|
; <label>:29: ; preds = %._crit_edge, %.preheader
|
|
|
|
%30 = add nuw nsw i64 %i1.04, 1
|
|
|
|
%exitcond12 = icmp ne i64 %30, %n
|
|
|
|
br i1 %exitcond12, label %.preheader, label %._crit_edge6
|
|
|
|
|
|
|
|
._crit_edge6: ; preds = %29
|
|
|
|
br label %"name"
|
|
|
|
|
|
|
|
"name":
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2021-05-25 01:43:40 +08:00
|
|
|
attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
[ScopInfo] Do not use LLVM names to identify statements, arrays, and parameters
LLVM-IR names are commonly available in debug builds, but often not in release
builds. Hence, using LLVM-IR names to identify statements or memory reference
results makes the behavior of Polly depend on the compile mode. This is
undesirable. Hence, we now just number the statements instead of using LLVM-IR
names to identify them (this issue has previously been brought up by Zino
Benaissa).
However, as LLVM-IR names help in making test cases more readable, we add an
option '-polly-use-llvm-names' to still use LLVM-IR names. This flag is by
default set in the polly tests to make test cases more readable.
This change reduces the time in ScopInfo from 32 seconds to 2 seconds for the
following test case provided by Eli Friedman <efriedma@codeaurora.org> (already
used in one of the previous commits):
struct X { int x; };
void a();
#define SIG (int x, X **y, X **z)
typedef void (*fn)SIG;
#define FN { for (int i = 0; i < x; ++i) { (*y)[i].x += (*z)[i].x; } a(); }
#define FN5 FN FN FN FN FN
#define FN25 FN5 FN5 FN5 FN5
#define FN125 FN25 FN25 FN25 FN25 FN25
#define FN250 FN125 FN125
#define FN1250 FN250 FN250 FN250 FN250 FN250
void x SIG { FN1250 }
For a larger benchmark I have on-hand (10000 loops), this reduces the time for
running -polly-scops from 5 minutes to 4 minutes, a reduction by 20%.
The reason for this large speedup is that our previous use of printAsOperand
had a quadratic cost, as for each printed and unnamed operand the full function
was scanned to find the instruction number that identifies the operand.
We do not need to adjust the way memory reference ids are constructured, as
they do not use LLVM values.
Reviewed by: efriedma
Tags: #polly
Differential Revision: https://reviews.llvm.org/D32789
llvm-svn: 302072
2017-05-04 04:08:52 +08:00
|
|
|
|
|
|
|
!llvm.ident = !{!0}
|
|
|
|
|
|
|
|
!0 = !{!"Ubuntu clang version 3.7.1-3ubuntu4 (tags/RELEASE_371/final) (based on LLVM 3.7.1)"}
|