79 lines · plain
1; RUN: llc < %s -mtriple=avr | FileCheck %s2 3; This tests how LLVM handles IR which puts very high4; presure on the PTRREGS class for the register allocator.5;6; This causes a problem because we only have one small register7; class for loading and storing from pointers - 'PTRREGS'.8; One of these registers is also used for the frame pointer, meaning9; that we only ever have two registers available for these operations.10;11; There is an existing bug filed for this issue - PR14879.12;13; The specific failure:14; LLVM ERROR: ran out of registers during register allocation15;16; It has been assembled from the following c code:17;18; struct ss19; {20; int a;21; int b;22; int c;23; };24;25; void loop(struct ss *x, struct ss **y, int z)26; {27; int i;28; for (i=0; i<z; ++i)29; {30; x->c += y[i]->b;31; }32; }33 34%struct.ss = type { i16, i16, i16 }35 36; CHECK-LABEL: loop37define void @loop(ptr %x, ptr %y, i16 %z) #0 {38entry:39 %x.addr = alloca ptr, align 240 %y.addr = alloca ptr, align 241 %z.addr = alloca i16, align 242 %i = alloca i16, align 243 store ptr %x, ptr %x.addr, align 244 store ptr %y, ptr %y.addr, align 245 store i16 %z, ptr %z.addr, align 246 store i16 0, ptr %i, align 247 br label %for.cond48 49for.cond: ; preds = %for.inc, %entry50 %tmp = load i16, ptr %i, align 251 %tmp1 = load i16, ptr %z.addr, align 252 %cmp = icmp slt i16 %tmp, %tmp153 br i1 %cmp, label %for.body, label %for.end54 55for.body: ; preds = %for.cond56 %tmp2 = load ptr, ptr %y.addr, align 257 %tmp3 = load i16, ptr %i, align 258 %arrayidx = getelementptr inbounds ptr, ptr %tmp2, i16 %tmp359 %tmp4 = load ptr, ptr %arrayidx, align 260 %b = getelementptr inbounds %struct.ss, ptr %tmp4, i32 0, i32 161 %tmp5 = load i16, ptr %b, align 262 %tmp6 = load ptr, ptr %x.addr, align 263 %c = getelementptr inbounds %struct.ss, ptr %tmp6, i32 0, i32 264 %tmp7 = load i16, ptr %c, align 265 %add = add nsw i16 %tmp7, %tmp566 store i16 %add, ptr %c, align 267 br label %for.inc68 69for.inc: ; preds = %for.body70 %tmp8 = load i16, ptr %i, align 271 %inc = add nsw i16 %tmp8, 172 store i16 %inc, ptr %i, align 273 br label %for.cond74 75for.end: ; preds = %for.cond76 ret void77}78 79