wlei added subscribers: modimo, hoy, wlei.
wlei added a comment.

Hi @ahatanak

We recently hit an issue of inconsistent codegen related with this 
optimization. In one build, Clang frontend generates different llvm IRs for the 
same function that is originally from one header file. It turned out this 
optimization gives different results for different function definition order 
which is naturally unstable.

See this two repro programs:

p1.cpp: https://godbolt.org/z/bavTYEG1x

  void foo() {};
  void bar() noexcept {foo();};


p2.cpp: https://godbolt.org/z/zfsnzPrE6

  void foo();
  void bar() noexcept {foo();};
  void foo(){};

See the codegens of bar are different, for p2.cpp, the callee(foo)’s definition 
is after the caller(bar), it's unknown to be marked `nounwind` before it see 
foo's definition, so it still generates the `invoke` things.

This inconsistency affected the AutoFDO, one of our work assigns consecutive 
number IDs to the BBs of CFG, the unstable CFGs causes the BB ID mismatched and 
a lot of samples are lost.

Would like to hear from your feedback. Wondering if FE can handle this 
perfectly or perhaps we can just leave it for BE. Thank you in advance!

cc @hoy @modimo @wenlei


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83906/new/

https://reviews.llvm.org/D83906

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to