[llvm-dev] Useless exit instruction in "main", replaceable with return inst
Friedman, Eli via llvm-dev
llvm-dev at lists.llvm.org
Tue Apr 3 10:31:42 PDT 2018
On 4/3/2018 9:24 AM, Dávid Bolvanský via llvm-dev wrote:
> Hi,
>
> LLVM optimizer seems to leave "call exit" instruction in "main"
> function but it could be replaced by a return instruction.
> Any reason why leave it as is or this simple optimization could be
> implemented e.g. in SimplifyLibCalls?
The usual answer to this sort of question is "nobody has implemented it
yet". And frankly, it's not really worth implementing; a minor size
reduction on a cold path in main() has very little benefit. (And
strictly speaking, C allows programs to recursively call main().)
-Eli
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
More information about the llvm-dev
mailing list