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 { ptr }
\r
8 @global = internal global [121 x i8] zeroinitializer, align 1
\r
10 define void @func() #0 {
\r
13 %s = alloca ptr, align 4
\r
14 %j = alloca i32, align 4
\r
15 store ptr @global, ptr %s, align 4
\r
16 store i32 0, ptr %j, align 4
\r
19 for.cond: ; preds = %for.inc, %entry
\r
20 %0 = load i32, ptr %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 ptr, ptr %s, align 4
\r
26 %add.ptr = getelementptr inbounds i8, ptr %1, i32 4
\r
27 %2 = ptrtoint ptr %add.ptr to i32
\r
28 %3 = load ptr, ptr %s, align 4
\r
29 %add.ptr1 = getelementptr inbounds i8, ptr %3, i32 4
\r
30 %4 = ptrtoint ptr %add.ptr1 to i32
\r
31 %rem = urem i32 %4, 2
\r
32 %cmp2 = icmp eq i32 %rem, 0
\r
33 br i1 %cmp2, label %cond.true, label %cond.false
\r
35 cond.true: ; preds = %for.body
\r
38 cond.false: ; preds = %for.body
\r
39 %5 = load ptr, ptr %s, align 4
\r
40 %add.ptr3 = getelementptr inbounds i8, ptr %5, i32 4
\r
41 %6 = ptrtoint ptr %add.ptr3 to i32
\r
42 %rem4 = urem i32 %6, 2
\r
45 cond.end: ; preds = %cond.false, %cond.true
\r
46 %cond = phi i32 [ 0, %cond.true ], [ %rem4, %cond.false ]
\r
47 %add = add i32 %2, %cond
\r
48 %7 = inttoptr i32 %add to ptr
\r
49 %8 = load ptr, ptr %s, align 4
\r
50 %next = getelementptr inbounds %struct.ST, ptr %8, i32 0, i32 0
\r
51 store ptr %7, ptr %next, align 4
\r
52 %9 = load ptr, ptr %s, align 4
\r
53 %next5 = getelementptr inbounds %struct.ST, ptr %9, i32 0, i32 0
\r
54 %10 = load ptr, ptr %next5, align 4
\r
55 store ptr %10, ptr %s, align 4
\r
58 for.inc: ; preds = %cond.end
\r
59 %11 = load i32, ptr %j, align 4
\r
60 %inc = add nsw i32 %11, 1
\r
61 store i32 %inc, ptr %j, align 4
\r
64 for.end: ; preds = %for.cond
\r
65 %12 = load ptr, ptr %s, align 4
\r
66 %next6 = getelementptr inbounds %struct.ST, ptr %12, i32 0, i32 0
\r
67 store ptr null, ptr %next6, align 4
\r