Skip to content

Commit 64c0bb8

Browse files
authored
Merge pull request swiftlang#30849 from eeckstein/fix-compile-time
SIL Optimizer: Fix two compile time issues
2 parents 66ea6e6 + 756c7f9 commit 64c0bb8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

include/swift/SIL/Projection.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ class Projection {
255255
unsigned getIndex() const {
256256
return Value.getIndex();
257257
}
258+
259+
unsigned getHash() const { return (unsigned)Value.getStorage(); }
258260

259261
/// Determine if I is a value projection instruction whose corresponding
260262
/// projection equals this projection.
@@ -689,7 +691,7 @@ static inline llvm::hash_code hash_value(const ProjectionPath &P) {
689691

690692
/// Returns the hashcode for the projection path.
691693
static inline llvm::hash_code hash_value(const Projection &P) {
692-
return llvm::hash_combine(static_cast<unsigned>(P.getKind()));
694+
return llvm::hash_combine(P.getHash());
693695
}
694696

695697
class ProjectionTree;

lib/SILOptimizer/Transforms/PerformanceInliner.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,9 @@ bool SILPerformanceInliner::inlineCallsIntoFunction(SILFunction *Caller) {
915915
return false;
916916

917917
// Second step: do the actual inlining.
918-
for (auto AI : AppliesToInline) {
918+
// We inline in reverse order, because for very large blocks with many applies
919+
// to inline, splitting the block at every apply would be quadratic.
920+
for (auto AI : llvm::reverse(AppliesToInline)) {
919921
SILFunction *Callee = AI.getReferencedFunctionOrNull();
920922
assert(Callee && "apply_inst does not have a direct callee anymore");
921923

0 commit comments

Comments
 (0)