diff options
| author | James Molloy <james.molloy@arm.com> | 2016-11-14 11:14:41 +0000 |
|---|---|---|
| committer | James Molloy <james.molloy@arm.com> | 2016-11-14 11:14:41 +0000 |
| commit | 6df8f27c95a514b19476a0e6f66107575281f158 (patch) | |
| tree | fb872b100d4b398072a9e6017a71de557a9b6024 /llvm/test/Transforms/Inline/inline-cold.ll | |
| parent | 059680f3f0c1b755b04425562efdf7284ff9ac70 (diff) | |
| download | bcm5719-llvm-6df8f27c95a514b19476a0e6f66107575281f158.tar.gz bcm5719-llvm-6df8f27c95a514b19476a0e6f66107575281f158.zip | |
[InlineCost] Remove skew when calculating call costs
When calculating the cost of a call instruction we were applying a heuristic penalty as well as the cost of the instruction itself.
However, when calculating the benefit from inlining we weren't discounting the equivalent penalty for the call instruction that would be removed! This caused skew in the calculation and meant we wouldn't inline in the following, trivial case:
int g() {
h();
}
int f() {
g();
}
llvm-svn: 286814
Diffstat (limited to 'llvm/test/Transforms/Inline/inline-cold.ll')
| -rw-r--r-- | llvm/test/Transforms/Inline/inline-cold.ll | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Inline/inline-cold.ll b/llvm/test/Transforms/Inline/inline-cold.ll index b3c134538a4..93d2569d87a 100644 --- a/llvm/test/Transforms/Inline/inline-cold.ll +++ b/llvm/test/Transforms/Inline/inline-cold.ll @@ -17,6 +17,7 @@ ; Function Attrs: nounwind readnone uwtable define i32 @simpleFunction(i32 %a) #0 { entry: + call void @extern() %a1 = load volatile i32, i32* @a %x1 = add i32 %a1, %a1 %a2 = load volatile i32, i32* @a @@ -54,6 +55,7 @@ define i32 @ColdFunction(i32 %a) #1 { ; DEFAULT-LABEL: @ColdFunction ; DEFAULT: ret entry: + call void @extern() %a1 = load volatile i32, i32* @a %x1 = add i32 %a1, %a1 %a2 = load volatile i32, i32* @a @@ -91,6 +93,7 @@ define i32 @ColdFunction2(i32 %a) #1 { ; DEFAULT-LABEL: @ColdFunction2 ; DEFAULT: ret entry: + call void @extern() %a1 = load volatile i32, i32* @a %x1 = add i32 %a1, %a1 %a2 = load volatile i32, i32* @a @@ -196,5 +199,6 @@ entry: ret i32 %add } +declare void @extern() attributes #0 = { nounwind readnone uwtable } attributes #1 = { nounwind cold readnone uwtable } |

