Bug 236859

Summary: [Tools] Sanitizer builds should obey `set-webkit-configuration --force-optimization-level`
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: Tools / TestsAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, bfulgham, emw, ews-watchlist, jbedard, mark.lam, saam, tuomas.webkit, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 205787    
Bug Blocks:    
Attachments:
Description Flags
Patch v1 none

Description David Kilzer (:ddkilzer) 2022-02-18 13:03:44 PST
Sanitizer builds should obey `set-webkit-configuration --force-optimization-level` when set.

The reason it doesn't currently work that a command-line Xcode variable won't override the same variable from an xcconfig file specified on the command-line.
Comment 1 Radar WebKit Bug Importer 2022-02-18 13:04:17 PST
<rdar://problem/89161649>
Comment 2 David Kilzer (:ddkilzer) 2022-02-18 13:24:24 PST
Created attachment 452571 [details]
Patch v1
Comment 3 David Kilzer (:ddkilzer) 2022-02-18 13:27:45 PST
Comment on attachment 452571 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=452571&action=review

> Tools/sanitizer/sanitizer.xcconfig:12
> +WK_OVERRIDE_OPTIMIZATION_LEVEL = $(WK_NOT_$(WK_EMPTY_$(WK_FORCE_OPTIMIZATION_LEVEL)));
> +
> +GCC_OPTIMIZATION_LEVEL = $(GCC_OPTIMIZATION_LEVEL_OVERRIDE_$(WK_OVERRIDE_OPTIMIZATION_LEVEL));
> +GCC_OPTIMIZATION_LEVEL_OVERRIDE_YES = $(WK_FORCE_OPTIMIZATION_LEVEL);
> +GCC_OPTIMIZATION_LEVEL_OVERRIDE_NO = $(GCC_OPTIMIZATION_LEVEL_OVERRIDE_NO_$(CONFIGURATION));
> +GCC_OPTIMIZATION_LEVEL_OVERRIDE_NO_Debug = 0;
> +GCC_OPTIMIZATION_LEVEL_OVERRIDE_NO_Production = 1;
> +GCC_OPTIMIZATION_LEVEL_OVERRIDE_NO_Release = 1;

I could copy this code into every `Base.xcconfig` file if we wanted to simplify the the `webkitdirs.pm` change to only set `WK_FORCE_OPTIMIZATION_LEVEL`, but I wasn't sure it was worth the extra complexity.

One advantage to making that change is that it makes it slightly clearer when the optimization level is being overridden, though you can still tell by noticing when `GCC_OPTIMIZATION_LEVEL` is set on the xcodebuild command-line.
Comment 4 Brent Fulgham 2022-02-18 16:40:52 PST
Comment on attachment 452571 [details]
Patch v1

I think this looks good as-is. We can consider moving things to Base.xcconfig if we need to do this elsewhere.
Comment 5 Aakash Jain 2022-02-18 16:56:40 PST
Cancelled https://ews-build.webkit.org/#/builders/70/builds/736 to speed up mac-wk2 queue. It already finished running layout-tests and the failures were pre-existing.
Comment 6 EWS 2022-02-18 23:20:50 PST
Committed r290199 (247527@main): <https://commits.webkit.org/247527@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 452571 [details].