[llvm-dev] Problems with tbaa in llvm 4.0

Erik de Castro Lopo via llvm-dev llvm-dev at lists.llvm.org
Fri Jan 13 16:57:47 PST 2017


Hi all,

I do a little work on the GHC haskell compiler. One of the things I
do is compile current GHC git HEAD against the next release of LLVM
to find issues and adapt the GHC code as early as possible.

A recent modification to LLVM is now rejecting GHC generated LLVM
IR that was previously accepted. I discussed this on IRC with
sanjoyd who explained what had changed and gave me some hints about
trying to fix it. Basically the issue (as I understood it) was that
no statements should reference the root tbaa node directly.

With that in mind, I came up with a fix to GHC llvm codegen so the
the tbaa metadata is now:

    !0 = !{!"root", null}
    !1 = !{!"top", !0}
    !2 = !{!"stack", !1}
    !3 = !{!"heap", !1}
    !4 = !{!"rx", !3}
    !5 = !{!"base", !1}

However, with this fix I get basically the same set of error messages
A couple of the errors are:

    Access type node must be a valid scalar type
      %ln59 = load i64, i64* %ln58, !tbaa !6
    !6 = !{!2, !2, i64 0}
    !2 = !{!"top", !3}

    Access type node must be a valid scalar type
      %ln5d = load i64, i64* %ln5c, !tbaa !4
    !4 = !{!5, !5, i64 0}
    !5 = !{!"base", !2}

    Access type node must be a valid scalar type
      %ln5i = load i64, i64* %ln5h, !tbaa !0
    !0 = !{!1, !1, i64 0}
    !1 = !{!"stack", !2}

I would appreciate any clues that might help me solve this.

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the llvm-dev mailing list