1 ; NOTE: This is a timeout test for some O(something silly) constant folding behaviour. It may not be the best test. Providing it finishes, it passes.
\r
2 ; RUN: opt < %s -O3 -S | FileCheck %s
\r
3 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
\r
4 target triple = "armv8-none-eabi"
\r
6 %struct.ST = type { %struct.ST* }
\r
8 @global = internal global [121 x i8] zeroinitializer, align 1
\r
10 define void @func() #0 {
\r
13 %s = alloca %struct.ST*, align 4
\r
14 %j = alloca i32, align 4
\r
15 store %struct.ST* bitcast ([121 x i8]* @global to %struct.ST*), %struct.ST** %s, align 4
\r
16 store i32 0, i32* %j, align 4
\r
19 for.cond: ; preds = %for.inc, %entry
\r
20 %0 = load i32, i32* %j, align 4
\r
21 %cmp = icmp slt i32 %0, 30
\r
22 br i1 %cmp, label %for.body, label %for.end
\r
24 for.body: ; preds = %for.cond
\r
25 %1 = load %struct.ST*, %struct.ST** %s, align 4
\r
26 %2 = bitcast %struct.ST* %1 to i8*
\r
27 %add.ptr = getelementptr inbounds i8, i8* %2, i32 4
\r
28 %3 = ptrtoint i8* %add.ptr to i32
\r
29 %4 = load %struct.ST*, %struct.ST** %s, align 4
\r
30 %5 = bitcast %struct.ST* %4 to i8*
\r
31 %add.ptr1 = getelementptr inbounds i8, i8* %5, i32 4
\r
32 %6 = ptrtoint i8* %add.ptr1 to i32
\r
33 %rem = urem i32 %6, 2
\r
34 %cmp2 = icmp eq i32 %rem, 0
\r
35 br i1 %cmp2, label %cond.true, label %cond.false
\r
37 cond.true: ; preds = %for.body
\r
40 cond.false: ; preds = %for.body
\r
41 %7 = load %struct.ST*, %struct.ST** %s, align 4
\r
42 %8 = bitcast %struct.ST* %7 to i8*
\r
43 %add.ptr3 = getelementptr inbounds i8, i8* %8, i32 4
\r
44 %9 = ptrtoint i8* %add.ptr3 to i32
\r
45 %rem4 = urem i32 %9, 2
\r
48 cond.end: ; preds = %cond.false, %cond.true
\r
49 %cond = phi i32 [ 0, %cond.true ], [ %rem4, %cond.false ]
\r
50 %add = add i32 %3, %cond
\r
51 %10 = inttoptr i32 %add to %struct.ST*
\r
52 %11 = load %struct.ST*, %struct.ST** %s, align 4
\r
53 %next = getelementptr inbounds %struct.ST, %struct.ST* %11, i32 0, i32 0
\r
54 store %struct.ST* %10, %struct.ST** %next, align 4
\r
55 %12 = load %struct.ST*, %struct.ST** %s, align 4
\r
56 %next5 = getelementptr inbounds %struct.ST, %struct.ST* %12, i32 0, i32 0
\r
57 %13 = load %struct.ST*, %struct.ST** %next5, align 4
\r
58 store %struct.ST* %13, %struct.ST** %s, align 4
\r
61 for.inc: ; preds = %cond.end
\r
62 %14 = load i32, i32* %j, align 4
\r
63 %inc = add nsw i32 %14, 1
\r
64 store i32 %inc, i32* %j, align 4
\r
67 for.end: ; preds = %for.cond
\r
68 %15 = load %struct.ST*, %struct.ST** %s, align 4
\r
69 %next6 = getelementptr inbounds %struct.ST, %struct.ST* %15, i32 0, i32 0
\r
70 store %struct.ST* null, %struct.ST** %next6, align 4
\r