Skip to content

[6.2🍒] SILOptimizer: Disable invalid passes in C++-only compiler #81050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ function(_add_host_variant_c_compile_flags target)
target_compile_definitions(${target} PRIVATE
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:_LARGEFILE_SOURCE _FILE_OFFSET_BITS=64>)
endif()

target_compile_definitions(${target} PRIVATE
$<$<AND:$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>,$<BOOL:${SWIFT_ENABLE_SWIFT_IN_SWIFT}>>:SWIFT_ENABLE_SWIFT_IN_SWIFT>)
endfunction()

function(_add_host_variant_link_flags target)
Expand Down
6 changes: 6 additions & 0 deletions lib/SILOptimizer/LoopTransforms/LoopRotate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,12 @@ namespace {
class LoopRotation : public SILFunctionTransform {

void run() override {
#ifndef SWIFT_ENABLE_SWIFT_IN_SWIFT
// This pass results in verification failures when Swift sources are not
// enabled.
LLVM_DEBUG(llvm::dbgs() << "Loop Rotate disabled in C++-only Swift compiler\n");
return;
#endif // !SWIFT_ENABLE_SWIFT_IN_SWIFT
SILFunction *f = getFunction();
SILLoopAnalysis *loopAnalysis = PM->getAnalysis<SILLoopAnalysis>();
DominanceAnalysis *domAnalysis = PM->getAnalysis<DominanceAnalysis>();
Expand Down
6 changes: 6 additions & 0 deletions lib/SILOptimizer/Transforms/SimplifyCFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3317,6 +3317,12 @@ static bool splitBBArguments(SILFunction &Fn) {
}

bool SimplifyCFG::run() {
#ifndef SWIFT_ENABLE_SWIFT_IN_SWIFT
// This pass results in verification failures when Swift sources are not
// enabled.
LLVM_DEBUG(llvm::dbgs() << "SimplifyCFG disabled in C++-only Swift compiler\n");
return false;
#endif //!SWIFT_ENABLE_SWIFT_IN_SWIFT
LLVM_DEBUG(llvm::dbgs() << "### Run SimplifyCFG on " << Fn.getName() << '\n');

// Disable some expensive optimizations if the function is huge.
Expand Down