Unofficial Hacker News companion — get notified on comment replies, and more.

So, I rewrote my game in C3 (opens external site)

159 points by lerno 5 days ago | www.madrigalgames.com | 46 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (4)

  1. There are also certain IR patterns that trigger what is essentially quadratic compilation time in LLVM.

    We found that out the hard way, when we compiled our relatively simple scripting language, only to be faced with minutes of compilation for scripts of ~2000 lines. Larger tweaks to the front end to avoid certain patterns worked to a degree.

    The point is, IR matters more than one might think.

    Replies (1)
    1. what patterns do you mean? I know people don't really like phi nodes, and managing locals, so they spill everything to memory by default, which is kinda bad.
      Replies (2)
      1. That's not really that much of a problem. Try loading and storing large structures instead of using llvm.memcpy. That's quite a bit worse I believe.
      2. We never fully understood what exactly triggered it, and it's been a while, but I believe it was due to too many local %foo variables. Each compiled line would generate a bunch of temporary variables that were only required within that line. That appeared to put some pressure on some pass. We then began re-using variables over lines, which did not fix the root issue, but brought compile times into acceptable ranges.