-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take into account the cost of local intervals when selecting split ca…
…ndidate. When selecting a split candidate for region splitting, the register allocator tries to predict which candidate will have the cheapest spill cost. Global splitting may cause the creation of local intervals, and they might spill. This patch makes RA take into account the spill cost of local split intervals in use blocks (we already take into account the spill cost in through blocks). A flag ("-condsider-local-interval-cost") controls weather we do this advanced cost calculation (it's on by default for X86 target, off for the rest). Differential Revision: https://reviews.llvm.org/D41585 Change-Id: Icccb8ad2dbf13124f5d97a18c67d95aa6be0d14d llvm-svn: 323870
- llvmorg-21-init
- llvmorg-20.1.0
- llvmorg-20.1.0-rc3
- llvmorg-20.1.0-rc2
- llvmorg-20.1.0-rc1
- llvmorg-20-init
- llvmorg-19.1.7
- llvmorg-19.1.6
- llvmorg-19.1.5
- llvmorg-19.1.4
- llvmorg-19.1.3
- llvmorg-19.1.2
- llvmorg-19.1.1
- llvmorg-19.1.0
- llvmorg-19.1.0-rc4
- llvmorg-19.1.0-rc3
- llvmorg-19.1.0-rc2
- llvmorg-19.1.0-rc1
- llvmorg-19-init
- llvmorg-18.1.8
- llvmorg-18.1.7
- llvmorg-18.1.6
- llvmorg-18.1.5
- llvmorg-18.1.4
- llvmorg-18.1.3
- llvmorg-18.1.2
- llvmorg-18.1.1
- llvmorg-18.1.0
- llvmorg-18.1.0-rc4
- llvmorg-18.1.0-rc3
- llvmorg-18.1.0-rc2
- llvmorg-18.1.0-rc1
- llvmorg-18-init
- llvmorg-17.0.6
- llvmorg-17.0.5
- llvmorg-17.0.4
- llvmorg-17.0.3
- llvmorg-17.0.2
- llvmorg-17.0.1
- llvmorg-17.0.0
- llvmorg-17.0.0-rc4
- llvmorg-17.0.0-rc3
- llvmorg-17.0.0-rc2
- llvmorg-17.0.0-rc1
- llvmorg-17-init
- llvmorg-16.0.6
- llvmorg-16.0.5
- llvmorg-16.0.4
- llvmorg-16.0.3
- llvmorg-16.0.2
- llvmorg-16.0.1
- llvmorg-16.0.0
- llvmorg-16.0.0-rc4
- llvmorg-16.0.0-rc3
- llvmorg-16.0.0-rc2
- llvmorg-16.0.0-rc1
- llvmorg-16-init
- llvmorg-15.0.7
- llvmorg-15.0.6
- llvmorg-15.0.5
- llvmorg-15.0.4
- llvmorg-15.0.3
- llvmorg-15.0.2
- llvmorg-15.0.1
- llvmorg-15.0.0
- llvmorg-15.0.0-rc3
- llvmorg-15.0.0-rc2
- llvmorg-15.0.0-rc1
- llvmorg-15-init
- llvmorg-14.0.6
- llvmorg-14.0.5
- llvmorg-14.0.4
- llvmorg-14.0.3
- llvmorg-14.0.2
- llvmorg-14.0.1
- llvmorg-14.0.0
- llvmorg-14.0.0-rc4
- llvmorg-14.0.0-rc3
- llvmorg-14.0.0-rc2
- llvmorg-14.0.0-rc1
- llvmorg-14-init
- llvmorg-13.0.1
- llvmorg-13.0.1-rc3
- llvmorg-13.0.1-rc2
- llvmorg-13.0.1-rc1
- llvmorg-13.0.0
- llvmorg-13.0.0-rc4
- llvmorg-13.0.0-rc3
- llvmorg-13.0.0-rc2
- llvmorg-13.0.0-rc1
- llvmorg-13-init
- llvmorg-12.0.1
- llvmorg-12.0.1-rc4
- llvmorg-12.0.1-rc3
- llvmorg-12.0.1-rc2
- llvmorg-12.0.1-rc1
- llvmorg-12.0.0
- llvmorg-12.0.0-rc5
- llvmorg-12.0.0-rc4
- llvmorg-12.0.0-rc3
- llvmorg-12.0.0-rc2
- llvmorg-12.0.0-rc1
- llvmorg-12-init
- llvmorg-11.1.0
- llvmorg-11.1.0-rc3
- llvmorg-11.1.0-rc2
- llvmorg-11.1.0-rc1
- llvmorg-11.0.1
- llvmorg-11.0.1-rc2
- llvmorg-11.0.1-rc1
- llvmorg-11.0.0
- llvmorg-11.0.0-rc6
- llvmorg-11.0.0-rc5
- llvmorg-11.0.0-rc4
- llvmorg-11.0.0-rc3
- llvmorg-11.0.0-rc2
- llvmorg-11.0.0-rc1
- llvmorg-11-init
- llvmorg-10.0.1
- llvmorg-10.0.1-rc4
- llvmorg-10.0.1-rc3
- llvmorg-10.0.1-rc2
- llvmorg-10.0.1-rc1
- llvmorg-10.0.0
- llvmorg-10.0.0-rc6
- llvmorg-10.0.0-rc5
- llvmorg-10.0.0-rc4
- llvmorg-10.0.0-rc3
- llvmorg-10.0.0-rc2
- llvmorg-10.0.0-rc1
- llvmorg-10-init
- llvmorg-9.0.1
- llvmorg-9.0.1-rc3
- llvmorg-9.0.1-rc2
- llvmorg-9.0.1-rc1
- llvmorg-9.0.0
- llvmorg-9.0.0-rc6
- llvmorg-9.0.0-rc5
- llvmorg-9.0.0-rc4
- llvmorg-9.0.0-rc3
- llvmorg-9.0.0-rc2
- llvmorg-9.0.0-rc1
- llvmorg-8.0.1
- llvmorg-8.0.1-rc4
- llvmorg-8.0.1-rc3
- llvmorg-8.0.1-rc2
- llvmorg-8.0.1-rc1
- llvmorg-8.0.0
- llvmorg-8.0.0-rc5
- llvmorg-8.0.0-rc4
- llvmorg-8.0.0-rc3
- llvmorg-8.0.0-rc2
- llvmorg-8.0.0-rc1
- llvmorg-7.1.0
- llvmorg-7.1.0-rc1
- llvmorg-7.0.1
- llvmorg-7.0.1-rc3
- llvmorg-7.0.1-rc2
- llvmorg-7.0.1-rc1
- llvmorg-7.0.0
- llvmorg-7.0.0-rc3
- llvmorg-7.0.0-rc2
- llvmorg-7.0.0-rc1
Marina Yatsina
committed
Jan 31, 2018
1 parent
2e442a7
commit cd5bc4a
Showing
6 changed files
with
312 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
; RUN: llc < %s -march=x86 -regalloc=greedy --debug-only=regalloc 2>&1 | FileCheck %s | ||
|
||
; This test is meant to make sure that the weight of local intervals that are | ||
; created during split is taken into account when choosing the best candidate | ||
; register. | ||
; %shl is the interval that will be split. | ||
; The inline assembly calls interfere with %shl and make only 2 available split | ||
; candidates - %esi and %ebp. | ||
; The old code would have chosen %esi as the split candidate ignoring the fact | ||
; that this choice will cause the creation of a local interval that will have a | ||
; certain spill cost. | ||
; The new code choses %ebp as the split candidate as it has lower spill cost. | ||
|
||
; Make sure the split behaves as expected | ||
; CHECK: RS_Split Cascade 1 | ||
; CHECK-NOT: %eax static = | ||
; CHECK: %eax no positive bundles | ||
; CHECK-NEXT: %ecx no positive bundles | ||
; CHECK-NEXT: %edx no positive bundles | ||
; CHECK-NEXT: %esi static = | ||
; CHECK-NEXT: %edi no positive bundles | ||
; CHECK-NEXT: %ebx no positive bundles | ||
; CHECK-NEXT: %ebp static = | ||
; CHECK: Split for %ebp | ||
|
||
; Function Attrs: nounwind | ||
define i32 @foo(i32* %array, i32 %cond1, i32 %val) local_unnamed_addr #0 { | ||
entry: | ||
%array.addr = alloca i32*, align 4 | ||
store i32* %array, i32** %array.addr, align 4, !tbaa !3 | ||
%0 = load i32, i32* %array, align 4, !tbaa !7 | ||
%arrayidx1 = getelementptr inbounds i32, i32* %array, i32 1 | ||
%1 = load i32, i32* %arrayidx1, align 4, !tbaa !7 | ||
%arrayidx2 = getelementptr inbounds i32, i32* %array, i32 2 | ||
%2 = load i32, i32* %arrayidx2, align 4, !tbaa !7 | ||
%arrayidx3 = getelementptr inbounds i32, i32* %array, i32 3 | ||
%3 = load i32, i32* %arrayidx3, align 4, !tbaa !7 | ||
%arrayidx4 = getelementptr inbounds i32, i32* %array, i32 4 | ||
%4 = load i32, i32* %arrayidx4, align 4, !tbaa !7 | ||
%arrayidx6 = getelementptr inbounds i32, i32* %array, i32 %val | ||
%5 = load i32, i32* %arrayidx6, align 4, !tbaa !7 | ||
%shl = shl i32 %5, 5 | ||
%tobool = icmp eq i32 %cond1, 0 | ||
br i1 %tobool, label %if.else, label %if.then | ||
|
||
if.then: ; preds = %entry | ||
%arrayidx7 = getelementptr inbounds i32, i32* %array, i32 6 | ||
store i32 %shl, i32* %arrayidx7, align 4, !tbaa !7 | ||
call void asm "nop", "=*m,r,r,r,r,r,*m,~{dirflag},~{fpsr},~{flags}"(i32** nonnull %array.addr, i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32** nonnull %array.addr) #1, !srcloc !9 | ||
%6 = load i32*, i32** %array.addr, align 4, !tbaa !3 | ||
%arrayidx8 = getelementptr inbounds i32, i32* %6, i32 7 | ||
br label %if.end | ||
|
||
if.else: ; preds = %entry | ||
%arrayidx5 = getelementptr inbounds i32, i32* %array, i32 5 | ||
%7 = load i32, i32* %arrayidx5, align 4, !tbaa !7 | ||
%arrayidx9 = getelementptr inbounds i32, i32* %array, i32 8 | ||
store i32 %shl, i32* %arrayidx9, align 4, !tbaa !7 | ||
call void asm "nop", "=*m,{ax},{bx},{cx},{dx},{di},{si},{ebp},*m,~{dirflag},~{fpsr},~{flags}"(i32** nonnull %array.addr, i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %7, i32* undef, i32** nonnull %array.addr) #1, !srcloc !10 | ||
%8 = load i32*, i32** %array.addr, align 4, !tbaa !3 | ||
%arrayidx10 = getelementptr inbounds i32, i32* %8, i32 9 | ||
br label %if.end | ||
|
||
if.end: ; preds = %if.else, %if.then | ||
%arrayidx10.sink = phi i32* [ %arrayidx10, %if.else ], [ %arrayidx8, %if.then ] | ||
%9 = phi i32* [ %8, %if.else ], [ %6, %if.then ] | ||
store i32 %shl, i32* %arrayidx10.sink, align 4, !tbaa !7 | ||
%10 = load i32, i32* %9, align 4, !tbaa !7 | ||
%add = add nsw i32 %10, %shl | ||
ret i32 %add | ||
} | ||
|
||
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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" "unsafe-fp-math"="false" "use-soft-float"="false" } | ||
attributes #1 = { nounwind } | ||
|
||
!llvm.module.flags = !{!0, !1} | ||
!llvm.ident = !{!2} | ||
|
||
!0 = !{i32 1, !"NumRegisterParameters", i32 0} | ||
!1 = !{i32 1, !"wchar_size", i32 4} | ||
!2 = !{!"clang version 6.0.0"} | ||
!3 = !{!4, !4, i64 0} | ||
!4 = !{!"any pointer", !5, i64 0} | ||
!5 = !{!"omnipotent char", !6, i64 0} | ||
!6 = !{!"Simple C/C++ TBAA"} | ||
!7 = !{!8, !8, i64 0} | ||
!8 = !{!"int", !5, i64 0} | ||
!9 = !{i32 268} | ||
!10 = !{i32 390} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters