News for hackers. Stuff that matters.
Re:Show HN: QBE – a new compiler back end by tinco on Saturday April 23, 2016 @02:03PM (#11556605)
Hi Munin, I'm writing a C compiler on LLVM at the moment, and hitting problems with types and pointers, the complexity of which made me think of just using casts everywhere. What is it that makes it expend speed of the generated code? Does it mean certain LLVM optimizer phases won't work anymore?
Re:Show HN: QBE – a new compiler back end by sklogic on Sunday April 24, 2016 @06:45AM (#11559236)
Types in C should not be complex. If you're hitting some kind of complexity, you're likely doing it the wrong way. C types are directly translated (one way, of course) into LLVM types.

Casts are evil: they break aliasing analysis, they screw up address spaces, they break more advanced forms of vectorisation (like polyhedral analysis), etc.

Re:Show HN: QBE – a new compiler back end by riscy on Saturday April 23, 2016 @06:05PM (#11557627)
Most casts have zero performance cost and will not interfere with alias analysis. The exception for alias analysis is that inttoptr/ptrtoint is discouraged for address calculation, but the analysis can reason about that. Performance wise, I can see casts between float/int to not be free since they may appear in the final output.
Re:Show HN: QBE – a new compiler back end by wlievens on Saturday April 23, 2016 @02:40PM (#11556787)
I'm not LLVM expert but usually the answer to that kind of question is aliasing...