[GHC] #15929: Explore whether adding XRay attributes to LLVM IR is worthwhile

GHC ghc-devs at haskell.org
Fri Dec 14 17:13:53 UTC 2018


#15929: Explore whether adding XRay attributes to LLVM IR is worthwhile
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.2
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mpickering):

 I investigated some more and get the basic support working. None of the
 call stack stuff is useful for GHC as every call is a tail call so the
 call hierarchy is completely flat.

 Here is the branch: https://github.com/mpickering/ghc/tree/llvm-xray

 See this thread on llvm-devs for some of the problems and suggestions of
 the LLVM devs: http://lists.llvm.org/pipermail/llvm-
 dev/2018-December/128184.html

 Here's an example comment I was using to compile which correctly
 instrumented a binary.

 {{{
 _build/stage1/bin/ghc -fllvm -ddump-llvm llvm.hs -opta="-v" -pgma=clang
 -pgmc=clang -pgml=clang -optl="-fxray-instrument" -optl="-fxray-
 instruction-threshold=1" -optlo="-O0" -O2 -g3 -fforce-recomp
 nofib/real/fulsom/Main.hs  -inofib/real/fulsom/
 }}}

 Problems

 1. You have to pass `-O0` to `opt` as otherwise the LLVM verifier
 complains about our debugging information. See the email list for more
 information about this.
 2. It didn't seem like every call was actually counted in some simple
 tests but I didn't look too closely.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15929#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list