Puzzled by this behavior

deadalnix deadalnix at gmail.com
Thu Jun 2 22:50:30 UTC 2022


On Thursday, 2 June 2022 at 22:36:55 UTC, Ola Fosheim Grøstad 
wrote:
> It is important to retain all the type information and 
> constraints so that they can be exploited. One weakness in 
> Clang is that the translation to the LLVM IR has tossed away 
> too much information (type/constraints). Maybe ask yourself if 
> there is some information worth retaining from template 
> expansion, like template constraints? Constraints = 
> opportunities to deduce.
>

You'll note that LLVM supports keeping that information around, 
and rust does use this, but C++'s semantic make it effectively 
useless for optimization anyways.

> I guess one would want to start by listing the passes you wish 
> to perform and the information you need to do so. Maybe look at 
> what data structures Swift has landed on to support ARC passes? 
> Another thing worth looking at is Boogie, which performs some 
> transforms so that asserts in functions can be resolved (on a 
> lucky day) by an SMT solver.
>

I mean, the usual suspect: Combine, CSE, GVN, DCE, simplify CFG, 
Inlining, etc...

As for an SMT solver, that sound like a good way to destroy your 
compile time.

BTW, Swift is using an SSA, but without phi nodes, then instead 
have basic block take arguments and branch instruction take 
parameters.

> Maybe start with something minimal (for a language subset) and 
> try to write som passes for that minimal subset, then you get a 
> feel for what you need. I think I would do that, so you can try 
> different options with lower costs.

SDC already has a full mid level IR that supports most of the 
language.



More information about the Digitalmars-d mailing list