[PATCH] D15777: [GlobalOpt] Globals used only in "main" can more easily be localized

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 05:34:15 PST 2016


jmolloy requested changes to this revision.
jmolloy added a comment.
This revision now requires changes to proceed.

Hi,

No, this is not correct. The behaviour was very deliberately changed in r253168. main() is not guaranteed to be non-recursive in C, D, Python, Ruby, Rust or any other language. The only language I know that gives that guarantee is C++, and there was a corresponding change in Clang to mark "main" as norecurse in C++ mode.

Yes, I'm aware this can pessimize some C programs (notably a popular embedded benchmark). However correctness must trump performance when there is no alternative!

James


http://reviews.llvm.org/D15777





More information about the llvm-commits mailing list