brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · ea1ca51 Raw
92 lines · plain
1; RUN: llc < %s -mtriple=i686 -regalloc=greedy --debug-only=regalloc 2>&1 | FileCheck %s2 3; REQUIRES: asserts4 5; This test is meant to make sure that the weight of local intervals that are6; created during split is taken into account when choosing the best candidate7; register.8; %shl is the interval that will be split.9; The inline assembly calls interfere with %shl and make only 2 available split10; candidates - %esi and %ebp.11; The old code would have chosen %esi as the split candidate ignoring the fact12; that this choice will cause the creation of a local interval that will have a13;  certain spill cost.14; The new code choses %ebp as the split candidate as it has lower spill cost.15 16; Make sure the split behaves as expected17; CHECK: RS_Split Cascade 118; CHECK-NOT: $eax	static = 19; CHECK: $eax	no positive bundles20; CHECK-NEXT: $ecx	no positive bundles21; CHECK-NEXT: $edx	no positive bundles22; CHECK-NEXT: $esi	static = 23; CHECK-NEXT: $edi	no positive bundles24; CHECK-NEXT: $ebx	no positive bundles25; CHECK-NEXT: $ebp	static = 26; CHECK: Split for $ebp27 28; Function Attrs: nounwind29define i32 @foo(ptr %array, i32 %cond1, i32 %val) local_unnamed_addr #0 {30entry:31  %array.addr = alloca ptr, align 432  store ptr %array, ptr %array.addr, align 4, !tbaa !333  %0 = load i32, ptr %array, align 4, !tbaa !734  %arrayidx1 = getelementptr inbounds i32, ptr %array, i32 135  %1 = load i32, ptr %arrayidx1, align 4, !tbaa !736  %arrayidx2 = getelementptr inbounds i32, ptr %array, i32 237  %2 = load i32, ptr %arrayidx2, align 4, !tbaa !738  %arrayidx3 = getelementptr inbounds i32, ptr %array, i32 339  %3 = load i32, ptr %arrayidx3, align 4, !tbaa !740  %arrayidx4 = getelementptr inbounds i32, ptr %array, i32 441  %4 = load i32, ptr %arrayidx4, align 4, !tbaa !742  %arrayidx6 = getelementptr inbounds i32, ptr %array, i32 %val43  %5 = load i32, ptr %arrayidx6, align 4, !tbaa !744  %shl = shl i32 %5, 545  %tobool = icmp eq i32 %cond1, 046  br i1 %tobool, label %if.else, label %if.then47 48if.then:                                          ; preds = %entry49  %arrayidx7 = getelementptr inbounds i32, ptr %array, i32 650  store i32 %shl, ptr %arrayidx7, align 4, !tbaa !751  call void asm "nop", "=*m,r,r,r,r,r,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(ptr) nonnull %array.addr, i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, ptr elementtype(ptr) nonnull %array.addr) #1, !srcloc !952  %6 = load ptr, ptr %array.addr, align 4, !tbaa !353  %arrayidx8 = getelementptr inbounds i32, ptr %6, i32 754  br label %if.end55 56if.else:                                          ; preds = %entry57  %arrayidx5 = getelementptr inbounds i32, ptr %array, i32 558  %7 = load i32, ptr %arrayidx5, align 4, !tbaa !759  %arrayidx9 = getelementptr inbounds i32, ptr %array, i32 860  store i32 %shl, ptr %arrayidx9, align 4, !tbaa !761  call void asm "nop", "=*m,{ax},{bx},{cx},{dx},{di},{si},{ebp},*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(ptr) nonnull %array.addr, i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %7, ptr undef, ptr elementtype(ptr) nonnull %array.addr) #1, !srcloc !1062  %8 = load ptr, ptr %array.addr, align 4, !tbaa !363  %arrayidx10 = getelementptr inbounds i32, ptr %8, i32 964  br label %if.end65 66if.end:                                           ; preds = %if.else, %if.then67  %arrayidx10.sink = phi ptr [ %arrayidx10, %if.else ], [ %arrayidx8, %if.then ]68  %9 = phi ptr [ %8, %if.else ], [ %6, %if.then ]69  store i32 %shl, ptr %arrayidx10.sink, align 4, !tbaa !770  %10 = load i32, ptr %9, align 4, !tbaa !771  %add = add nsw i32 %10, %shl72  ret i32 %add73}74 75attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+x87" "use-soft-float"="false" }76attributes #1 = { nounwind }77 78!llvm.module.flags = !{!0, !1}79!llvm.ident = !{!2}80 81!0 = !{i32 1, !"NumRegisterParameters", i32 0}82!1 = !{i32 1, !"wchar_size", i32 4}83!2 = !{!"clang version 6.0.0"}84!3 = !{!4, !4, i64 0}85!4 = !{!"any pointer", !5, i64 0}86!5 = !{!"omnipotent char", !6, i64 0}87!6 = !{!"Simple C/C++ TBAA"}88!7 = !{!8, !8, i64 0}89!8 = !{!"int", !5, i64 0}90!9 = !{i32 268}91!10 = !{i32 390}92