File: multidim_fold_constant_dim_zero.ll

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (59 lines) | stat: -rw-r--r-- 2,441 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=print<polly-function-scops>' -debug -disable-output < %s 2>&1 | FileCheck %s

; REQUIRES: asserts

; This test case at some point crashed Polly due to a 'division by zero'
; when trying to fold the constant dimension into outer dimension.
; We verify that this scop is detected without crash. We also test the
; output to understand that the scop has been analyzed, but has also been
; invalidated due to the zero size dimension.

; CHECK: Assumed Context:
; CHECK-NEXT: {  : false }
; CHECK-NEXT: Invalid Context:
; CHECK-NEXT: {  : false }
; CHECK:      Arrays {
; CHECK-NEXT:     i8 MemRef_arg[*][0]; // Element size 1
; CHECK-NEXT: }
; CHECK-NEXT: Arrays (Bounds as pw_affs) {
; CHECK-NEXT:     i8 MemRef_arg[*][ { [] -> [(0)] } ]; // Element size 1
; CHECK-NEXT: }
; CHECK-NEXT: Alias Groups (0):
; CHECK-NEXT:     n/a
; CHECK-NEXT: Statements {
; CHECK-NEXT: 	Stmt_bb2
; CHECK-NEXT:         Domain :=
; CHECK-NEXT:             { Stmt_bb2[] };
; CHECK-NEXT:         Schedule :=
; CHECK-NEXT:             { Stmt_bb2[] -> [] };
; CHECK-NEXT:         MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT:             { Stmt_bb2[] -> MemRef_arg[0, 0] };
; CHECK-NEXT:         MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT:             { Stmt_bb2[] -> MemRef_arg[o0, o1] : false };
; CHECK-NEXT: }

target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"

declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i32, i1) #0

define void @hoge([0 x [0 x i8]]* noalias %arg) {
bb:
  br label %bb1

bb1:                                              ; preds = %bb5, %bb
  br i1 false, label %bb5, label %bb2

bb2:                                              ; preds = %bb1
  %tmp = getelementptr [0 x [0 x i8]], [0 x [0 x i8]]* %arg, i64 0, i64 0, i64 0
  store i8 32, i8* %tmp, align 1
  %tmp3 = getelementptr [0 x [0 x i8]], [0 x [0 x i8]]* %arg, i64 0, i64 0, i64 0
  %tmp4 = getelementptr i8, i8* %tmp3, i64 1
  tail call void @llvm.memset.p0i8.i64(i8* %tmp4, i8 32, i64 0, i32 1, i1 false)
  br label %bb5

bb5:                                              ; preds = %bb2, %bb1
  br i1 undef, label %bb6, label %bb1

bb6:                                              ; preds = %bb5
  ret void
}