Erik de Castro Lopo via llvm-dev
2017-Jan-14 00:57 UTC
[llvm-dev] Problems with tbaa in llvm 4.0
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/
[+Sanjoy] On 01/13/2017 06:57 PM, Erik de Castro Lopo via llvm-dev wrote:> 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-- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory
Hi Erik, (I've already replied on IRC, but echoing that here for others) Hal Finkel wrote:> [+Sanjoy] > > > On 01/13/2017 06:57 PM, Erik de Castro Lopo via llvm-dev wrote: >> 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}You need to change !0 to !{!"root"}. Root nodes must have a single operand. -- Sanjoy>> !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 >