mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SILOptimizer: Disable invalid passes in C++-only compiler
The SimplifyCFG and LoopRotate passes result in verification failures when built in a compiler that is not built with Swift sources enabled. Fixes: rdar://146357242
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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>();
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user