News for hackers. Stuff that matters.
Re:On the Madness of Optimizing Compilers by rlpb on Tuesday March 08, 2016 @02:58AM (#11244036)
"If you get any of this wrong, even in an edge case, the user is presented with non-working code for a valid program, and the compiler writer has failed at his or her one task."

Perhaps languages could be designed so as to make this task easier?

In language design we end up torn between making things easier for the programmer and making things easier for the compiler-designed-for-performance. Doing both things well is perhaps something that language design will be able to improve upon in the future.

Re:On the Madness of Optimizing Compilers by akkartik on Tuesday March 08, 2016 @03:11AM (#11244064)
A degenerate case is my project, which makes people write assembly, but in a very safe way that it can check. You lose the expressivity of conventional HLLs, but still get their safety benefits.

https://github.com/akkartik/mu

Re:On the Madness of Optimizing Compilers by jcr on Tuesday March 08, 2016 @04:38AM (#11244324)
After reading the mu link you posted, I was going to ask you to submit it as a "Show HN" post... but it seems I'm about a month too late:

https://news.ycombinator.com/item?id=11092067

It's great reading. thanks.

Re:On the Madness of Optimizing Compilers by carussell on Tuesday March 08, 2016 @03:14AM (#11244069)
See also: http://cr.yp.to/qhasm/literature.html

> The programmer using such a system will write his beautifully-structured, but possibly inefficient, program P; then he will interactively specify transformations that make it efficient.

Re:On the Madness of Optimizing Compilers by bijection on Tuesday March 08, 2016 @03:23AM (#11244100)
Halide is a neat example of this approach in an image processing context [1] [2]

[1] http://halide-lang.org/

[2] https://people.csail.mit.edu/jrk/jrkthesis.pdf "Decoupling Algorithms from the Organization of Computation for High Performance Image Processing"

Re:On the Madness of Optimizing Compilers by dkopi on Tuesday March 08, 2016 @03:10AM (#11244061)
Languages and compilers actually do have constructs for programmers to make things easier for the compiler.

"inline" and "register" are two very known examples. Other examples are function attributes in gcc: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html

Re:On the Madness of Optimizing Compilers by nkurz on Tuesday March 08, 2016 @03:48AM (#11244160)
I presume you're aware that you've chosen two controversial examples? "register" has been formally deprecated in C++, and has been ignored by (almost?) all C compilers for decades: http://stackoverflow.com/questions/20618008/replacement-for-...

And most current wisdom is that "inline" no longer serves as a useful performance suggestion to the compiler, but instead should only be used as a linkage directive to allow multiple declarations of the same function: http://stackoverflow.com/questions/29796264/is-there-still-a...

Re:On the Madness of Optimizing Compilers by dkopi on Tuesday March 08, 2016 @04:01AM (#11244208)
Great points. As compilers evolve, optimizers are even more knowledgeable of what should be put in a register or inline that the programmer.

But those are still 2 well known features that were added intentionally to help improve performance.

Re:On the Madness of Optimizing Compilers by 0x07c0 on Tuesday March 08, 2016 @06:14AM (#11244642)
restrict is probably a better example! https://en.wikipedia.org/wiki/Restrict
Re:On the Madness of Optimizing Compilers by dkopi on Tuesday March 08, 2016 @07:51AM (#11244895)
great example