1. 3

  2. 2

    While I appreciate the benefit of these passes existing in llvm, I do wish clang had its own slightly higher IR that was C[++] aligned. A lot of work in many of the llvm IR passes are essentially trying to reconstruct information that would have been available had the code not been lowered directly to llvm IR.

    Many aeons ago while I was compiling Haskell by starting at GHCs Core representation had to put a lot of effort into reconstructing what the original Haskell was doing - in Core the Haskell specific things like type classes, basic API behaviour, etc has all been lowered to an very pure functional language that had nothing beyond a pure function + ADT setup. So I spent much more time reconstructing those things than I did on the implementation of my actual thesis work.

    1. 2

      While there’s no agreed canonical higher-level IR in Clang-land yet, there are at least several ongoing projects to define something like that, as highlighted in this LLVM forum thread.