[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH] tcc: remove buggy nodata_wanted optimization

From: Mikulas Patocka
Subject: Re: [Tinycc-devel] [PATCH] tcc: remove buggy nodata_wanted optimization
Date: Mon, 12 Mar 2018 18:25:02 +0100 (CET)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]