Skip to content

Commit 86bfeb9

Browse files
committed
Revert "Inlining: Run the legacy AlwaysInliner before the regular inliner."
This seems to cause large regressions in existing code, as much as 75% slower (4x the time taken). Small always inline functions seem to be used a lot in the cmsis-dsp library. I would add a phase ordering test to show the problems, but one already exists! The llvm/test/Transforms/PhaseOrdering/ARM/arm_mult_q15.ll was just changed by removing alwaysinline to hide the problems that existed. This reverts commit cae033d. This reverts commit 8e33c41.
1 parent c4a250e commit 86bfeb9

14 files changed

+397
-560
lines changed

clang/test/CodeGen/code-coverage.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// RUN: %clang_cc1 -emit-llvm-bc -o /dev/null -fdebug-pass-manager -fprofile-arcs %s 2>&1 | FileCheck --check-prefix=NEWPM %s
1515
// RUN: %clang_cc1 -emit-llvm-bc -o /dev/null -fdebug-pass-manager -fprofile-arcs -O3 %s 2>&1 | FileCheck --check-prefix=NEWPM-O3 %s
1616

17+
// NEWPM-NOT: Running pass
1718
// NEWPM: Running pass: GCOVProfilerPass
1819

1920
// NEWPM-O3-NOT: Running pass

clang/test/Frontend/optimization-remark-with-hotness-new-pm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void bar(int x) {
7373
// THRESHOLD-NOT: hotness
7474
// NO_PGO: '-fdiagnostics-show-hotness' requires profile-guided optimization information
7575
// NO_PGO: '-fdiagnostics-hotness-threshold=' requires profile-guided optimization information
76-
// expected-remark@+1 {{'foo' inlined into 'bar' with (cost=always): always inline attribute at callsite bar:8:10; (hotness:}}
76+
// expected-remark@+1 {{'foo' inlined into 'bar': always inline attribute at callsite bar:8:10; (hotness:}}
7777
sum += foo(x, x - 2);
7878
}
7979

clang/test/Headers/__clang_hip_math.hip

Lines changed: 376 additions & 375 deletions
Large diffs are not rendered by default.

clang/test/OpenMP/bug57757.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,24 @@ void foo() {
3232
// CHECK-NEXT: entry:
3333
// CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T:%.*]], ptr [[TMP1]], i64 0, i32 2
3434
// CHECK-NEXT: tail call void @llvm.experimental.noalias.scope.decl(metadata [[META13:![0-9]+]])
35-
// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4, !tbaa [[TBAA16:![0-9]+]], !alias.scope !13, !noalias !17
35+
// CHECK-NEXT: tail call void @llvm.experimental.noalias.scope.decl(metadata [[META16:![0-9]+]])
36+
// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4, !tbaa [[TBAA18:![0-9]+]], !alias.scope !13, !noalias !16
3637
// CHECK-NEXT: switch i32 [[TMP3]], label [[DOTOMP_OUTLINED__EXIT:%.*]] [
3738
// CHECK-NEXT: i32 0, label [[DOTUNTIED_JMP__I:%.*]]
3839
// CHECK-NEXT: i32 1, label [[DOTUNTIED_NEXT__I:%.*]]
3940
// CHECK-NEXT: ]
4041
// CHECK: .untied.jmp..i:
41-
// CHECK-NEXT: store i32 1, ptr [[TMP2]], align 4, !tbaa [[TBAA16]], !alias.scope !13, !noalias !17
42-
// CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @__kmpc_omp_task(ptr nonnull @[[GLOB1]], i32 [[TMP0]], ptr [[TMP1]]), !noalias !13
42+
// CHECK-NEXT: store i32 1, ptr [[TMP2]], align 4, !tbaa [[TBAA18]], !alias.scope !13, !noalias !16
43+
// CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @__kmpc_omp_task(ptr nonnull @[[GLOB1]], i32 [[TMP0]], ptr [[TMP1]]), !noalias !19
4344
// CHECK-NEXT: br label [[DOTOMP_OUTLINED__EXIT]]
4445
// CHECK: .untied.next..i:
4546
// CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES:%.*]], ptr [[TMP1]], i64 0, i32 1
4647
// CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES]], ptr [[TMP1]], i64 0, i32 1, i32 2
4748
// CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES]], ptr [[TMP1]], i64 0, i32 1, i32 1
48-
// CHECK-NEXT: [[TMP8:%.*]] = load ptr, ptr [[TMP5]], align 8, !tbaa [[TBAA19:![0-9]+]], !noalias !13
49-
// CHECK-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP7]], align 4, !tbaa [[TBAA16]], !noalias !13
50-
// CHECK-NEXT: [[TMP10:%.*]] = load float, ptr [[TMP6]], align 4, !tbaa [[TBAA20:![0-9]+]], !noalias !13
51-
// CHECK-NEXT: tail call void [[TMP8]](i32 noundef [[TMP9]], float noundef [[TMP10]]) #[[ATTR2:[0-9]+]], !noalias !13
49+
// CHECK-NEXT: [[TMP8:%.*]] = load ptr, ptr [[TMP5]], align 8, !tbaa [[TBAA20:![0-9]+]], !alias.scope !16, !noalias !13
50+
// CHECK-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP7]], align 4, !tbaa [[TBAA18]], !alias.scope !16, !noalias !13
51+
// CHECK-NEXT: [[TMP10:%.*]] = load float, ptr [[TMP6]], align 4, !tbaa [[TBAA21:![0-9]+]], !alias.scope !16, !noalias !13
52+
// CHECK-NEXT: tail call void [[TMP8]](i32 noundef [[TMP9]], float noundef [[TMP10]]) #[[ATTR2:[0-9]+]], !noalias !19
5253
// CHECK-NEXT: br label [[DOTOMP_OUTLINED__EXIT]]
5354
// CHECK: .omp_outlined..exit:
5455
// CHECK-NEXT: ret i32 0

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static cl::opt<bool> EnableModuleInliner("enable-module-inliner",
161161
cl::desc("Enable module inliner"));
162162

163163
static cl::opt<bool> PerformMandatoryInliningsFirst(
164-
"mandatory-inlining-first", cl::init(false), cl::Hidden,
164+
"mandatory-inlining-first", cl::init(true), cl::Hidden,
165165
cl::desc("Perform mandatory inlinings module-wide, before performing "
166166
"inlining"));
167167

@@ -1079,8 +1079,6 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
10791079
if (EnableSyntheticCounts && !PGOOpt)
10801080
MPM.addPass(SyntheticCountsPropagation());
10811081

1082-
MPM.addPass(AlwaysInlinerPass(/*InsertLifetimeIntrinsics=*/true));
1083-
10841082
if (EnableModuleInliner)
10851083
MPM.addPass(buildModuleInlinerPipeline(Level, Phase));
10861084
else

llvm/test/Other/new-pm-defaults.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@
122122
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
123123
; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
124124
; CHECK-O-NEXT: Running pass: SimplifyCFGPass
125-
; CHECK-O-NEXT: Running pass: AlwaysInlinerPass
126-
; CHECK-O-NEXT: Running analysis: ProfileSummaryAnalysis
127125
; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
128126
; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
129127
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
@@ -132,12 +130,14 @@
132130
; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
133131
; CHECK-O-NEXT: Invalidating analysis: AAManager
134132
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
133+
; CHECK-O-NEXT: Running analysis: ProfileSummaryAnalysis
135134
; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
136135
; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
137136
; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
138137
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
139138
; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
140139
; CHECK-O-NEXT: Running pass: InlinerPass
140+
; CHECK-O-NEXT: Running pass: InlinerPass
141141
; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
142142
; CHECK-O-NEXT: Running analysis: AAManager
143143
; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass

llvm/test/Other/new-pm-print-pipeline.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
; CHECK-20: cgscc(inline<only-mandatory>,inline),cgscc(inline)
6363

6464
; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='scc-oz-module-inliner' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-21
65-
; CHECK-21: require<globals-aa>,function(invalidate<aa>),require<profile-summary>,cgscc(devirt<4>(inline,{{.*}},instcombine{{.*}}))
65+
; CHECK-21: require<globals-aa>,function(invalidate<aa>),require<profile-summary>,cgscc(devirt<4>(inline<only-mandatory>,inline,{{.*}},instcombine{{.*}}))
6666

6767
; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='cgscc(function<eager-inv>(no-op-function)),function<eager-inv>(no-op-function)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-22
6868
; CHECK-22: cgscc(function<eager-inv>(no-op-function)),function<eager-inv>(no-op-function)

llvm/test/Other/new-pm-thinlto-defaults.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@
9999
; CHECK-O-NEXT: Running analysis: TypeBasedAA
100100
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
101101
; CHECK-O-NEXT: Running pass: SimplifyCFGPass
102-
; CHECK-O-NEXT: Running pass: AlwaysInlinerPass
103-
; CHECK-PRELINK-O-NEXT: Running analysis: ProfileSummaryAnalysis
104102
; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
105103
; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
106104
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
@@ -109,12 +107,14 @@
109107
; CHECK-O-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}AAManager
110108
; CHECK-O-NEXT: Invalidating analysis: AAManager
111109
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
110+
; CHECK-PRELINK-O-NEXT: Running analysis: ProfileSummaryAnalysis
112111
; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
113112
; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
114113
; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
115114
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
116115
; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
117116
; CHECK-O-NEXT: Running pass: InlinerPass
117+
; CHECK-O-NEXT: Running pass: InlinerPass
118118
; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
119119
; CHECK-O-NEXT: Running analysis: AAManager
120120
; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass

llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
; CHECK-O123-NEXT: Running analysis: BranchProbabilityAnalysis on foo
6464
; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
6565
; CHECK-O-NEXT: Running pass: SimplifyCFGPass
66-
; CHECK-O-NEXT: Running pass: AlwaysInlinerPass
6766
; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
6867
; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
6968
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
@@ -78,6 +77,7 @@
7877
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
7978
; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
8079
; CHECK-O-NEXT: Running pass: InlinerPass
80+
; CHECK-O-NEXT: Running pass: InlinerPass
8181
; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
8282
; CHECK-O-NEXT: Running analysis: AAManager
8383
; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass

llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
7474
; CHECK-O-NEXT: Running pass: SimplifyCFGPass on foo
7575

76-
; CHECK-O-NEXT: Running pass: AlwaysInlinerPass
7776
; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
7877
; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
7978
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
@@ -87,6 +86,7 @@
8786
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
8887
; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
8988
; CHECK-O-NEXT: Running pass: InlinerPass
89+
; CHECK-O-NEXT: Running pass: InlinerPass
9090
; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
9191
; CHECK-O-NEXT: Running analysis: AAManager
9292
; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass

llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
; CHECK-O-NEXT: Running pass: PGOIndirectCallPromotion on
8888
; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
8989
; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis on foo
90-
; CHECK-O-NEXT: Running pass: AlwaysInlinerPass
9190
; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
9291
; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
9392
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
@@ -102,6 +101,7 @@
102101
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
103102
; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
104103
; CHECK-O-NEXT: Running pass: InlinerPass
104+
; CHECK-O-NEXT: Running pass: InlinerPass
105105
; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
106106
; CHECK-O-NEXT: Running analysis: AAManager
107107
; CHECK-O-NEXT: Running analysis: BasicAA

llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
; CHECK-O123-NEXT: Running analysis: BranchProbabilityAnalysis on foo
6969
; CHECK-O-NEXT: Running analysis: PostDominatorTreeAnalysis on foo
7070
; CHECK-O-NEXT: Running pass: SimplifyCFGPass on foo
71-
; CHECK-O-NEXT: Running pass: AlwaysInlinerPass
7271
; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
7372
; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
7473
; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
@@ -82,6 +81,7 @@
8281
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
8382
; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
8483
; CHECK-O-NEXT: Running pass: InlinerPass
84+
; CHECK-O-NEXT: Running pass: InlinerPass
8585
; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
8686
; CHECK-O-NEXT: Running analysis: AAManager
8787
; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass

llvm/test/Transforms/Inline/always-inline-phase-ordering.ll

Lines changed: 0 additions & 164 deletions
This file was deleted.

llvm/test/Transforms/PhaseOrdering/ARM/arm_mult_q15.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,5 @@ declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
218218

219219
attributes #0 = { nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-m55" "target-features"="+armv8.1-m.main,+dsp,+fp-armv8d16,+fp-armv8d16sp,+fp16,+fp64,+fullfp16,+hwdiv,+lob,+mve,+mve.fp,+ras,+strict-align,+thumb-mode,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp,+vfp4d16,+vfp4d16sp,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-fp-armv8,-fp-armv8sp,-fp16fml,-hwdiv-arm,-i8mm,-neon,-sb,-sha2,-vfp3,-vfp3sp,-vfp4,-vfp4sp" "unsafe-fp-math"="true" }
220220
attributes #1 = { argmemonly nofree nosync nounwind willreturn }
221-
attributes #2 = { nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-m55" "target-features"="+armv8.1-m.main,+dsp,+fp-armv8d16,+fp-armv8d16sp,+fp16,+fp64,+fullfp16,+hwdiv,+lob,+mve,+mve.fp,+ras,+strict-align,+thumb-mode,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp,+vfp4d16,+vfp4d16sp,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-fp-armv8,-fp-armv8sp,-fp16fml,-hwdiv-arm,-i8mm,-neon,-sb,-sha2,-vfp3,-vfp3sp,-vfp4,-vfp4sp" "unsafe-fp-math"="true" }
221+
attributes #2 = { alwaysinline nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-m55" "target-features"="+armv8.1-m.main,+dsp,+fp-armv8d16,+fp-armv8d16sp,+fp16,+fp64,+fullfp16,+hwdiv,+lob,+mve,+mve.fp,+ras,+strict-align,+thumb-mode,+vfp2,+vfp2sp,+vfp3d16,+vfp3d16sp,+vfp4d16,+vfp4d16sp,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-fp-armv8,-fp-armv8sp,-fp16fml,-hwdiv-arm,-i8mm,-neon,-sb,-sha2,-vfp3,-vfp3sp,-vfp4,-vfp4sp" "unsafe-fp-math"="true" }
222222
attributes #3 = { nounwind }

0 commit comments

Comments
 (0)