On Fri, 23 Feb 2018, Michael Matz wrote:

> Hi,
> 
> On Thu, 22 Feb 2018, Mikulas Patocka wrote:
> 
> > I think that that nodata_wanted misoptimization should be removed at all 
> > - in the C language, you can jump to any location in the function with 
> > goto or switch-case statement - thus reasoning such as "all the 
> > variables behind if (0) are unreachable" is incorrect.
> > 
> > If you wanted to do that optimization correctly, you'd need to build 
> > control flow graph, and tcc is just too simple to do that.
> 
> You're right that as implemented the non-allocation of variables is wrong.  
> But a full CFG isn't needed to fix this, the allocation merely needs to be 
> postponed to the first real use.  Unfortunately that is somewhat 
> complicated when there are initializers (which matter only for static vars 
> in this case, but still).
> 
> So, yeah, the easy fix is to remove it, but with more work the 
> optimization (or parts of it) could be retained, grischka?
> 
> 
> Ciao,
> Michael.

I think tcc is too simple to do such optimizations as holding variables 
and allocating them when they are used. If I need an optimizing compiler, 
I use gcc, if I need something fast and simple, I use tcc.

Mikulas

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to