[llvm] r175553 - Fix a bug in mayHaveSideEffects. Functions that do not return are now considered as instructions with side effects.

Duncan Sands baldrick at free.fr
Thu Feb 21 00:29:23 PST 2013


Hi Hal,

> I think that we may want to adopt an N1528-like viewpoint on this and say that functions that don't return have undefined behavior/semantics unless explicitly marked.
>
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1528.htm

this is an interesting approach, but I'm not sure it is feasible for other
languages like Ada which doesn't allow the compiler to assume that all loops
are finite.  How is Ada to be turned into LLVM IR with this rule?  It can't
just output functions maybe containing infinite loops without special care
(eg without a noreturn marker), like it does now, because the optimizers might
mis-optimize (according to Ada semantics).  On the other hand, it can't just
add noreturn everywhere that it thinks maybe there might be an infinite loop,
because what if there isn't?

Ciao, Duncan.



More information about the llvm-commits mailing list