- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[bash] warning C4740: flow in or out of inline asm code suppresses global optimization[/bash]
This error is a little ambiguous: What is the scope of the suppression? I'm assuming it just means "cannot include this function in global optimization", but on the other hand, the builds are so fast when this error pops up that I get the impression they were suppressed for the entire link.
(Which is annoying, since the debug version of this library is compiled with global optimization enabled too, forcing the link to start over with /LTCG only to then appear not to actually do global optimization)
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the explaination for C4740:
http://msdn.microsoft.com/en-us/library/s93ckwz6(VS.80).aspx
http://msdn.microsoft.com/en-us/library/s93ckwz6(VS.80).aspx
Compiler Warning (Level 4) C4740
Error Message
flow in or out of inline asm code suppresses global optimization
When there is a jump in to or out of an asm block, global optimizations are disabled for that function.
The following sample generates C4740:
// C4740.cpp
// compile with: /O2 /W4
// processor: x86
int main() {
__asm jmp tester
tester:;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can really only speak to the Intel compiler here, so I'm not sure what Microsoft's compiler is exactly disabling, but most "global" optimizations (for example mod/ref aliasing analysis)are unable to work with such a structure, and since any such optimization requires a global scope to work (hence why it's a global optimization), the existence of such a construct precludes it from occuring where flow information is necessary.
And in fact, this kind of construct also hinders some globaloptimizations that just occur across basic blocks, so it's not justinterprocedural globaloptimizations that are going to be affected. The basic takeawayis that if you have such a construct and can re-code it so that the code doesn't use them, better performance is quite possible.
And in fact, this kind of construct also hinders some globaloptimizations that just occur across basic blocks, so it's not justinterprocedural globaloptimizations that are going to be affected. The basic takeawayis that if you have such a construct and can re-code it so that the code doesn't use them, better performance is quite possible.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page