VS2010 PGO中的这些“Expectation failed”消息是什么?我该如何修复它们?

时间:2013-01-15 19:52:55

标签: visual-studio-2010 pgo

当我执行PGO优化步骤(使用LINK.EXE /LTCG:PGU)时,Visual Studio 2010链接器会抱怨:

Merging foo!1.pgc
'FOO_EDGE::get_input': Arc 2 --> 4 has negative count (-414343)
Expectation failed: f line 4241
'FOO_DELAY::set_delay': Block 18 outgoing counts differ from block count (-9 diff)
Expectation failed: f line 4261
Expectation failed: f line 4211
'FOO_DELAY::set_delay': Arc 12 --> 23 has negative count (-3)
Expectation failed: f line 4220
Generating code
907 of 4948 ( 18.33%) profiled functions will be compiled for speed
4948 of 4948 functions (100.0%) were optimized using profile data
42912225037 of 42912225037 instructions (100.0%) were optimized using profile data

导致这些“预期失败”的原因是什么?我该如何解决这些问题?似乎PGO仍然在优化代码,但是我对这些消息存在时优化的质量/完整性有点怀疑。

1 个答案:

答案 0 :(得分:0)

执行PGO检测的多线程应用程序运行时,似乎会出现这些错误。可以通过编译(而非链接)与x64上的/PogoSafeMode标志来避免它们。

我没有发现MSDN documentation on this flag特别清楚;在多线程代码上执行PGO的正确过程是:

  1. 使用cl.exe /PogoSafeMode
  2. 进行编译
  3. link.exe /LTCG:PGI
  4. 的关联
  5. 执行多线程分析运行
  6. link.exe /LTCG:PGO
  7. 重新关联