You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/reference/gt-support-fiber-safe-thread-local-storage.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Supports fiber safety for data allocated using static thread-local storage, that
18
18
19
19
Data declared with `__declspec(thread)` is referenced through a thread-local storage (TLS) array. The TLS array is an array of addresses that the system maintains for each thread. Each address in this array gives the location of thread-local storage data.
20
20
21
-
A fiber is a lightweight object that consists of a stack and a register context and can be scheduled on various threads. A fiber can run on any thread. Because a fiber may get swapped out and restarted later on a different thread, the address of the TLS array must not be cached or optimized as a common subexpression across a function call. **`/GT`** prevents such optimizations.
21
+
A fiber is a lightweight object that consists of a stack and a register context and can be scheduled on various threads. A fiber can run on any thread. Because a fiber may get swapped out and restarted later on a different thread, the compiler mustn't cache the address of the TLS array, or optimize it as a common subexpression across a function call. **`/GT`** prevents such optimizations.
22
22
23
23
### To set this compiler option in the Visual Studio development environment
Copy file name to clipboardExpand all lines: docs/build/reference/ltcg-link-time-code-generation.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,13 @@ These options are deprecated starting in Visual Studio 2015:
21
21
### Arguments
22
22
23
23
**`INCREMENTAL`**<br/>
24
-
(Optional) Specifies that the linker only applies whole program optimization or link-time code generation (LTCG) to the set of files affected by an edit, instead of the entire project. By default, this flag is not set when **`/LTCG`** is specified, and the entire project is linked by using whole program optimization.
24
+
(Optional) Specifies that the linker only applies whole program optimization or link-time code generation (LTCG) to files affected by an edit, instead of the entire project. By default, this flag isn't set when **`/LTCG`** is specified, and the entire project is linked by using whole program optimization.
25
25
26
26
**`NOSTATUS`**|**`STATUS`**<br/>
27
-
(Optional) Specifies whether the linker displays a progress indicator that shows what percentage of the link is complete. By default, this status information is not displayed.
27
+
(Optional) Specifies whether the linker displays a progress indicator that shows what percentage of the link is complete. By default, this status information isn't displayed.
28
28
29
29
**`OFF`**<br/>
30
-
(Optional) Disables link-time code generation. This behavior is the same as when **`/LTCG`**is not specified on the command line.
30
+
(Optional) Disables link-time code generation. This behavior is the same as when **`/LTCG`**isn't specified on the command line.
31
31
32
32
**`PGINSTRUMENT`**<br/>
33
33
(Optional) This option is deprecated starting in Visual Studio 2015. Instead, use **`/LTCG`** and `[/GENPROFILE` or `/FASTGENPROFILE`](genprofile-fastgenprofile-generate-profiling-instrumented-build.md) to generate an instrumented build for profile-guided optimization. The data that is collected from instrumented runs is used to create an optimized image. For more information, see [Profile-Guided Optimizations](../profile-guided-optimizations.md). The short form of this option is **`/LTCG:PGI`**.
@@ -42,7 +42,7 @@ These options are deprecated starting in Visual Studio 2015:
42
42
43
43
The **`/LTCG`** option tells the linker to call the compiler and perform whole-program optimization. You can also do profile guided optimization. For more information, see [Profile-Guided Optimizations](../profile-guided-optimizations.md).
44
44
45
-
With the following exceptions, you cannot add linker options to the PGO combination of **`/LTCG`** and **`/USEPROFILE`** that were not specified in the previous PGO initialization combination of **`/LTCG`** and **`/GENPROFILE`** options:
45
+
With the following exceptions, you can't add linker options to the PGO combination of **`/LTCG`** and **`/USEPROFILE`** that weren't specified in the previous PGO initialization combination of **`/LTCG`** and **`/GENPROFILE`** options:
46
46
47
47
-[`/BASE`](base-base-address.md)
48
48
@@ -68,17 +68,17 @@ With the following exceptions, you cannot add linker options to the PGO combinat
68
68
69
69
-[`/VERBOSE`](verbose-print-progress-messages.md)
70
70
71
-
Any linker options that are specified together with the **`/LTCG`** and **`/GENPROFILE`** options to initialize PGO do not have to be specified when you build by using **`/LTCG`** and **`/USEPROFILE`**; they are implied.
71
+
Any linker options that are specified together with the **`/LTCG`** and **`/GENPROFILE`** options to initialize PGO don't have to be specified when you build by using **`/LTCG`** and **`/USEPROFILE`**; they're implied.
72
72
73
-
The rest of this article discusses **`/LTCG`** in terms of link-time code generation.
73
+
The rest of this article discusses the link-time code generation done by **`/LTCG`**.
74
74
75
75
**`/LTCG`** is implied with [`/GL`](gl-whole-program-optimization.md).
76
76
77
-
The linker invokes link-time code generation if it is passed a module that was compiled by using **`/GL`** or an MSIL module (see [`.netmodule` Files as Linker Input](netmodule-files-as-linker-input.md)). If you do not explicitly specify **`/LTCG`** when you pass **`/GL`** or MSIL modules to the linker, the linker eventually detects this and restarts the link by using **`/LTCG`**. Explicitly specify **`/LTCG`** when you pass **`/GL`** and MSIL modules to the linker for the fastest possible build performance.
77
+
The linker invokes link-time code generation if it's passed a module that was compiled by using **`/GL`** or an MSIL module (see [`.netmodule` Files as Linker Input](netmodule-files-as-linker-input.md)). If you don't explicitly specify **`/LTCG`** when you pass **`/GL`** or MSIL modules to the linker, the linker eventually detects this situation and restarts the link by using **`/LTCG`**. Explicitly specify **`/LTCG`** when you pass **`/GL`** and MSIL modules to the linker for the fastest possible build performance.
78
78
79
-
For even faster performance, use **`/LTCG:INCREMENTAL`**. This option tells the linker to only re-optimize the set of files that is affected by a source file change, instead of the entire project. This can significantly reduce the link time required. This is not the same option as incremental linking.
79
+
For even faster performance, use **`/LTCG:INCREMENTAL`**. This option tells the linker to reoptimize only the files affected by a source file change, instead of the entire project. This option can significantly reduce the link time required. This option isn't the same option as [incremental linking](incremental-link-incrementally.md).
80
80
81
-
**`/LTCG`**is not valid for use with [`/INCREMENTAL`](incremental-link-incrementally.md).
81
+
**`/LTCG`**isn't valid for use with [`/INCREMENTAL`](incremental-link-incrementally.md).
82
82
83
83
When **`/LTCG`** is used to link modules compiled by using [`/Og`](og-global-optimizations.md), [`/O1`](o1-o2-minimize-size-maximize-speed.md), [`/O2`](o1-o2-minimize-size-maximize-speed.md), or [`/Ox`](ox-full-optimization.md), the following optimizations are performed:
84
84
@@ -99,7 +99,7 @@ When **`/LTCG`** is used to link modules compiled by using [`/Og`](og-global-opt
99
99
100
100
Using **`/LTCG`** and **`/O2`** causes double-alignment optimization.
101
101
102
-
If **`/LTCG`** and **`/O1`** are specified, double alignment is not performed. If most of the functions in an application are compiled for speed, with a few functions compiled for size (for example, by using the [`optimize`](../../preprocessor/optimize.md) pragma), the compiler double-aligns the functions that are optimized for size if they call functions that require double alignment.
102
+
If **`/LTCG`** and **`/O1`** are specified, double alignment isn't performed. If most of the functions in an application are compiled for speed, with a few functions compiled for size (for example, by using the [`optimize`](../../preprocessor/optimize.md) pragma), the compiler double-aligns the functions that are optimized for size if they call functions that require double alignment.
103
103
104
104
If the compiler can identify all of the call sites of a function, the compiler ignores explicit calling-convention modifiers on a function and tries to optimize the function's calling convention:
105
105
@@ -109,7 +109,7 @@ If the compiler can identify all of the call sites of a function, the compiler i
109
109
110
110
- remove unused parameters
111
111
112
-
If a function is called through a function pointer, or if a function is called from outside a module that is compiled by using **`/GL`**, the compiler does not attempt to optimize the function's calling convention.
112
+
If a function is called through a function pointer, or if a function is called from outside a module that is compiled by using **`/GL`**, the compiler doesn't attempt to optimize the function's calling convention.
113
113
114
114
> [!NOTE]
115
115
> If you use **`/LTCG`** and redefine `mainCRTStartup`, your application can have unpredictable behavior that relates to user code that executes before global objects are initialized. There are three ways to address this issue: do not redefine `mainCRTStartup`, do not compile the file that contains `mainCRTStartup` by using **`/LTCG`**, or initialize global variables and objects statically.
@@ -120,7 +120,7 @@ Modules that are compiled by using [`/GL`](gl-whole-program-optimization.md) and
120
120
121
121
-**`/LTCG`** can accept native object files, and mixed native/managed object files (compiled by using **`/clr`**). The **`/clr:pure`** and **`/clr:safe`** compiler options are deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017 and later.
122
122
123
-
-**`/LTCG:PGI`**does not accept native modules compiled by using **`/GL`** and **`/clr`**
123
+
-**`/LTCG:PGI`**doesn't accept native modules compiled by using **`/GL`** and **`/clr`**
124
124
125
125
### To set this compiler option in the Visual Studio development environment
The **`/O`** options control various optimizations that help you create code for maximum speed or minimum size.
12
12
@@ -26,13 +26,13 @@ The **`/O`** options control various optimizations that help you create code for
26
26
27
27
-[`/Ot`](os-ot-favor-small-code-favor-fast-code.md) (a default setting) tells the compiler to favor optimizations for speed over optimizations for size.
28
28
29
-
-[`/Ox`](ox-full-optimization.md) is a combination option that selects several of the optimizations with an emphasis on speed. It is a strict subset of the **/O2** optimizations.
29
+
-[`/Ox`](ox-full-optimization.md) is a combination option that selects several of the optimizations with an emphasis on speed. **`/Ox`** is a strict subset of the **`/O2`** optimizations.
30
30
31
31
-[`/Oy`](oy-frame-pointer-omission.md) suppresses the creation of frame pointers on the call stack for quicker function calls.
32
32
33
33
## Remarks
34
34
35
-
You can combine multiple **`/O`** options into a single option statement. For example, **`/Odi`** is the same as **`/Od /Oi`**. Certain options are mutually exclusive and cause a compiler error if used together. See the individual **`/O`** options for more information.
35
+
You can combine multiple **`/O`** options into a single option statement. For example, **`/Odi`** is the same as **`/Od /Oi`**. Certain options are mutually exclusive and cause a compiler error if used together. For more information, see the individual **`/O`** options.
Copy file name to clipboardExpand all lines: docs/build/reference/og-global-optimizations.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -16,13 +16,13 @@ Deprecated. Provides local and global optimizations, automatic-register allocati
16
16
17
17
## Remarks
18
18
19
-
**`/Og`** is deprecated. These optimizations are now generally enabled by default. For more information on optimizations, see [`/O1`, `/O2` (Minimize Size, Maximize Speed)](o1-o2-minimize-size-maximize-speed.md) or [`/Ox` (Enable Most Speed Optimizations)](ox-full-optimization.md).
19
+
**`/Og`** is deprecated. These optimizations are now enabled by default when any optimizations are enabled. For more information on optimizations, see [`/O1`, `/O2` (Minimize Size, Maximize Speed)](o1-o2-minimize-size-maximize-speed.md), or [`/Ox` (Enable Most Speed Optimizations)](ox-full-optimization.md).
20
20
21
21
The following optimizations are available under **`/Og`**:
22
22
23
23
- Local and global common subexpression elimination
24
24
25
-
In this optimization, the value of a common subexpression is calculated once. In the following example, if the values of `b` and `c`do not change between the three expressions, the compiler can assign the calculation of `b + c` to a temporary variable, and substitute the variable for `b + c`:
25
+
In this optimization, the value of a common subexpression is calculated once. In the following example, if the values of `b` and `c`don't change between the three expressions, the compiler can assign the calculation of `b + c` to a temporary variable, and use that variable for `b + c`:
26
26
27
27
```C
28
28
a = b + c;
@@ -38,7 +38,7 @@ The following optimizations are available under **`/Og`**:
38
38
39
39
- Loop optimization
40
40
41
-
This optimization removes invariant subexpressions from the body of a loop. An optimal loop contains only expressions whose values change through each execution of the loop. In the following example, the expression `x + y` does not change in the loop body:
41
+
This optimization removes invariant subexpressions from the body of a loop. An optimal loop contains only expressions whose values change through each execution of the loop. In the following example, the expression `x + y` doesn't change in the loop body:
Copy file name to clipboardExpand all lines: docs/build/reference/os-ot-favor-small-code-favor-fast-code.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Minimizes or maximizes the size of EXEs and DLLs.
19
19
20
20
**`/Os`** (Favor Small Code) minimizes the size of EXEs and DLLs by instructing the compiler to favor size over speed. The compiler can reduce many C and C++ constructs to functionally similar sequences of machine code. Occasionally these differences offer tradeoffs of size versus speed. The **`/Os`** and **`/Ot`** options allow you to specify a preference for one over the other:
21
21
22
-
**`/Ot`** (Favor Fast Code) maximizes the speed of EXEs and DLLs by instructing the compiler to favor speed over size. This is the default when optimizations are enabled. The compiler can reduce many C and C++ constructs to functionally similar sequences of machine code. Occasionally, these differences offer tradeoffs of size versus speed. The **`/Ot`** option is implied by the [`/O2`](o1-o2-minimize-size-maximize-speed.md) (Maximize speed) option. The **`/O2`** option combines several options to produce very fast code.
22
+
**`/Ot`** (Favor Fast Code) maximizes the speed of EXEs and DLLs by instructing the compiler to favor speed over size. **`/Ot`** is the default when optimizations are enabled. The compiler can reduce many C and C++ constructs to functionally similar sequences of machine code. Occasionally, these differences offer tradeoffs of size versus speed. The **`/Ot`** option is implied by the [`/O2`](o1-o2-minimize-size-maximize-speed.md) (Maximize speed) option. The **`/O2`** option combines several options to produce faster code.
23
23
24
24
> [!NOTE]
25
25
> Information that's gathered from profiling test runs overrides any optimizations that would otherwise be in effect if you specify **`/Ob`**, **`/Os`**, or **`/Ot`**. For more information, see [Profile-Guided Optimizations](../profile-guided-optimizations.md).
The **`/Ox`** compiler option enables a combination of optimizations that favor speed. In some versions of the Visual Studio IDE and the compiler help message, this is called *full optimization*, but the **`/Ox`** compiler option enables only a subset of the speed optimization options enabled by **`/O2`**.
11
+
The **`/Ox`** compiler option enables a combination of optimizations that favor speed. In some versions of the Visual Studio IDE and the compiler help message, it's called *full optimization*, but the **`/Ox`** compiler option enables only a subset of the speed optimization options enabled by **`/O2`**.
12
12
13
13
## Syntax
14
14
15
15
> **`/Ox`**
16
16
17
17
## Remarks
18
18
19
-
The **`/Ox`** compiler option enables the **`/O`** compiler options that favor speed. The **`/Ox`** compiler option does not include the additional [`/GF` (Eliminate Duplicate Strings)](gf-eliminate-duplicate-strings.md) and [`/Gy` (Enable Function-Level Linking)](gy-enable-function-level-linking.md) options enabled by [`/O1` or `/O2` (Minimize Size, Maximize Speed)](o1-o2-minimize-size-maximize-speed.md). The additional options applied by **`/O1`** and **`/O2`** can cause pointers to strings or to functions to share a target address, which can affect debugging and strict language conformance. The **`/Ox`** option is an easy way to enable most optimizations without including **`/GF`** and **`/Gy`**. For more information, see the descriptions of the [`/GF`](gf-eliminate-duplicate-strings.md) and [`/Gy`](gy-enable-function-level-linking.md) options.
19
+
The **`/Ox`** compiler option enables the **`/O`** compiler options that favor speed. The **`/Ox`** compiler option doesn't include the additional [`/GF` (Eliminate Duplicate Strings)](gf-eliminate-duplicate-strings.md) and [`/Gy` (Enable Function-Level Linking)](gy-enable-function-level-linking.md) options enabled by [`/O1` or `/O2` (Minimize Size, Maximize Speed)](o1-o2-minimize-size-maximize-speed.md). The additional options applied by **`/O1`** and **`/O2`** can cause pointers to strings or to functions to share a target address, which can affect debugging and strict language conformance. The **`/Ox`** option is an easy way to enable most optimizations without including **`/GF`** and **`/Gy`**. For more information, see the descriptions of the [`/GF`](gf-eliminate-duplicate-strings.md) and [`/Gy`](gy-enable-function-level-linking.md) options.
20
20
21
21
The **`/Ox`** compiler option is the same as using the following options in combination:
0 commit comments