brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · aa72fb3 Raw
99 lines · plain
1; REQUIRES: asserts2; RUN: llc -mtriple=thumbv6m -regalloc=greedy -stats < %s 2>&1 | FileCheck %s3 4; Undef incoming values to phis end up creating IMPLICIT_DEF values. If we don't5; prefer them to be in a register then we get fewer spilled live ranges (66; compared to 7).7; CHECK: 6 regalloc - Number of spilled live ranges8 9declare i32 @otherfn(i32)10define void @fn(i32 %val, ptr %ptr) {11entry:12  %gep2 = getelementptr i32, ptr %ptr, i32 113  %gep3 = getelementptr i32, ptr %ptr, i32 214  %gep4 = getelementptr i32, ptr %ptr, i32 315  %gep5 = getelementptr i32, ptr %ptr, i32 416  %gep6 = getelementptr i32, ptr %ptr, i32 517  %gep7 = getelementptr i32, ptr %ptr, i32 618  %gep8 = getelementptr i32, ptr %ptr, i32 719  %cmp1 = icmp uge i32 %val, 320  br i1 %cmp1, label %if, label %then21 22if:23  %val1 = load i32, ptr %ptr, align 424  %val2 = load i32, ptr %gep2, align 425  %val3 = load i32, ptr %gep3, align 426  %val4 = load i32, ptr %gep4, align 427  %val5 = load i32, ptr %gep5, align 428  %val6 = load i32, ptr %gep6, align 429  %val7 = load i32, ptr %gep7, align 430  %val8 = load i32, ptr %gep8, align 431  br label %then32 33then:34  %phi1a = phi i32 [ %val1, %if ], [ undef, %entry ]35  %phi2a = phi i32 [ %val2, %if ], [ undef, %entry ]36  %phi3a = phi i32 [ %val3, %if ], [ undef, %entry ]37  %phi4a = phi i32 [ %val4, %if ], [ undef, %entry ]38  %phi5a = phi i32 [ %val5, %if ], [ undef, %entry ]39  %phi6a = phi i32 [ %val6, %if ], [ undef, %entry ]40  %phi7a = phi i32 [ %val7, %if ], [ undef, %entry ]41  %phi8a = phi i32 [ %val8, %if ], [ undef, %entry ]42  %switchval = call i32 @otherfn(i32 %val)43  switch i32 %switchval, label %default [44    i32 0, label %case045    i32 1, label %case146    i32 5, label %case547    i32 6, label %case648    i32 7, label %case749    i32 8, label %case850  ]51 52default:53  br label %switchend54 55case0:56  br label %switchend57 58case1:59  br label %switchend60 61case5:62  br label %switchend63 64case6:65  br label %switchend66 67case7:68  br label %switchend69 70case8:71  br label %switchend72 73switchend:74  %phi1b = phi i32 [ 0, %default ], [ undef, %case0 ], [ undef, %case1 ], [ %phi1a, %case5 ], [ 1, %case6 ], [ 2, %case7 ], [ 1, %case8 ]75  %phi2b = phi i32 [ 0, %default ], [ undef, %case0 ], [ undef, %case1 ], [ %phi2a, %case5 ], [ 2, %case6 ], [ 2, %case7 ], [ 1, %case8 ]76  %phi3b = phi i32 [ 0, %default ], [ undef, %case0 ], [ undef, %case1 ], [ %phi3a, %case5 ], [ 3, %case6 ], [ 2, %case7 ], [ 1, %case8 ]77  %phi4b = phi i32 [ 0, %default ], [ undef, %case0 ], [ undef, %case1 ], [ %phi4a, %case5 ], [ 4, %case6 ], [ 2, %case7 ], [ 1, %case8 ]78  %phi5b = phi i32 [ 0, %default ], [ undef, %case0 ], [ undef, %case1 ], [ %phi5a, %case5 ], [ 5, %case6 ], [ 2, %case7 ], [ 1, %case8 ]79  %phi6b = phi i32 [ 0, %default ], [ undef, %case0 ], [ undef, %case1 ], [ %phi6a, %case5 ], [ 6, %case6 ], [ 2, %case7 ], [ 1, %case8 ]80  %phi7b = phi i32 [ 0, %default ], [ undef, %case0 ], [ undef, %case1 ], [ %phi7a, %case5 ], [ 7, %case6 ], [ 2, %case7 ], [ 1, %case8 ]81  %phi8b = phi i32 [ 0, %default ], [ undef, %case0 ], [ undef, %case1 ], [ %phi8a, %case5 ], [ 8, %case6 ], [ 2, %case7 ], [ 1, %case8 ]82  %cmp2 = icmp uge i32 %val, 483  br i1 %cmp2, label %if2, label %end84 85if2:86  store i32 %phi1b, ptr %ptr, align 487  store i32 %phi2b, ptr %gep2, align 488  store i32 %phi3b, ptr %gep3, align 489  store i32 %phi4b, ptr %gep4, align 490  store i32 %phi5b, ptr %gep5, align 491  store i32 %phi6b, ptr %gep6, align 492  store i32 %phi7b, ptr %gep7, align 493  store i32 %phi8b, ptr %gep8, align 494  br label %end95 96end:97  ret void98}99