Skip to content

Commit 0cf71ed

Browse files
Merge pull request #11357 from aschwaighofer/frontend_default_to_onone_optimization
CompilerInvocation: If no optimization flag is set default to Onone
2 parents 4383062 + f442dd9 commit 0cf71ed

13 files changed

+1703
-1571
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,10 +1378,12 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
13781378
Args.hasArg(OPT_sil_serialize_witness_tables);
13791379

13801380
// Parse the optimization level.
1381+
// Default to Onone settings if no option is passed.
1382+
IRGenOpts.Optimize = false;
1383+
Opts.Optimization = SILOptions::SILOptMode::None;
13811384
if (const Arg *A = Args.getLastArg(OPT_O_Group)) {
13821385
if (A->getOption().matches(OPT_Onone)) {
1383-
IRGenOpts.Optimize = false;
1384-
Opts.Optimization = SILOptions::SILOptMode::None;
1386+
// Already set.
13851387
} else if (A->getOption().matches(OPT_Ounchecked)) {
13861388
// Turn on optimizations and remove all runtime checks.
13871389
IRGenOpts.Optimize = true;

test/DebugInfo/dbgvalue-insertpt.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ for i in 0 ..< 3 {
55
// CHECK: %i.addr = alloca i{{32|64}}
66
// CHECK-NEXT: call void @llvm.dbg.declare(metadata i{{32|64}}* %i.addr,
77
// CHECK-SAME: metadata ![[I:[0-9]+]],
8+
// CHECK: bitcast %TSiSg* %[[ALLOCA]] to i{{32|64}}*
89
// CHECK: %[[CAST:[0-9]+]] = bitcast %TSiSg* %[[ALLOCA]] to i{{32|64}}*
910
// CHECK: %[[LD:[0-9]+]] = load i{{32|64}}, i{{32|64}}* %[[CAST]]
1011
// CHECK: br i1 {{%.*}}, label %[[FAIL:.*]], label %[[SUCCESS:.*]],

test/IDE/Inputs/foo_swift_module.printed.comments.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import SwiftOnoneSupport
12

23
precedencegroup High {
34
associativity: left

test/IRGen/big_types_corner_cases.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public func enumCallee(_ x: LargeEnum) {
144144
// CHECK-64: alloca %T22big_types_corner_cases9LargeEnumO
145145
// CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64
146146
// CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64
147-
// CHECK-64: call %swift.type* @_T0ypMa()
147+
// CHECK-64: _T0s5printySayypGd_SS9separatorSS10terminatortF
148148
// CHECK-64: ret void
149149

150150
// CHECK-LABEL: define{{( protected)?}} internal swiftcc void @_T022big_types_corner_cases8SuperSubC1fyyFAA9BigStructVycfU_(%T22big_types_corner_cases9BigStructV* noalias nocapture sret, %T22big_types_corner_cases8SuperSubC*) #0 {

0 commit comments

Comments
 (0)