Zheng CZ Chen via llvm-dev
2018-Dec-07 01:29 UTC
[llvm-dev] Should intrinsics llvm.eh.sjlj.setjmp be with isBarrier flag?
Hi, I meet an issue when I verify machineinstrs for Powerpc testcases in llvm. llc -mtriple=powerpc64-unknown-linux-gnu < llvm/llvm/test/CodeGen/PowerPC/sj-ctr-loop.ll -verify-machineinstrs Bad machine code: MBB exits via unconditional fall-through but ends with a barrier instruction! *** function: main basic block: %bb.2 for.body.lr.ph (0x100275437e8) Content in block BB.2: BB#2: derived from LLVM BB %for.end Predecessors according to CFG: BB#1 %vreg2<def> = ADDIStocHA %X2, <ga:@env_sigill>; G8RC_and_G8RC_NOX0:%vreg2 %vreg3<def> = LDtocL <ga:@env_sigill>, %vreg2<kill>; mem:LD8[GOT] G8RC:%vreg3 G8RC_and_G8RC_NOX0:%vreg2 %vreg4<def> = EH_SjLj_SetJmp64 %vreg3<kill>, %CTR8<imp-def,dead>; GPRC:%vreg4 G8RC:%vreg3 Currently Powerpc sets EH_SjLj_SetJmp64 with flag isBarrier. But it is also a fall-through instruction. So it fails in machineinstr verifying. I checked other platforms like X86 and ARM, they also set this intrinsics as barrier. For my understanding, a barrier instruction means control flow can not fall through like llvm.eh.sjlj.longjmp and unconditional jumps. But setjmp should fall through. Is there any misunderstanding? Is there any specification reason for setting llvm.eh.sjlj.setjmp as a barrier? Thanks in advance. BRS// Chen Zheng Power Compiler Backend Developer -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181207/3dc0e49d/attachment.html>
Tim Northover via llvm-dev
2018-Dec-08 10:07 UTC
[llvm-dev] Should intrinsics llvm.eh.sjlj.setjmp be with isBarrier flag?
On Fri, 7 Dec 2018 at 18:25, Zheng CZ Chen via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Is there any misunderstanding? Is there any specification reason for setting llvm.eh.sjlj.setjmp as a barrier?I agree with you, the setjmp ones shouldn't be isBarrier. I suspect the original commit mistook the name "isBarrier" as referring to a memory fence-like construct. It's a fairly common mistake and could easily apply here. Cheers. Tim.
Zheng CZ Chen via llvm-dev
2018-Dec-10 01:39 UTC
[llvm-dev] Should intrinsics llvm.eh.sjlj.setjmp be with isBarrier flag?
Thanks for your reply. Patch is created https://reviews.llvm.org/D55499. Thanks. BRS// Chen Zheng Power Compiler Backend Developer From: Tim Northover <t.p.northover at gmail.com> To: czhengsz at cn.ibm.com Cc: LLVM Developers Mailing List <llvm-dev at lists.llvm.org> Date: 2018/12/08 06:07 PM Subject: Re: [llvm-dev] Should intrinsics llvm.eh.sjlj.setjmp be with isBarrier flag? On Fri, 7 Dec 2018 at 18:25, Zheng CZ Chen via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Is there any misunderstanding? Is there any specification reason forsetting llvm.eh.sjlj.setjmp as a barrier? I agree with you, the setjmp ones shouldn't be isBarrier. I suspect the original commit mistook the name "isBarrier" as referring to a memory fence-like construct. It's a fairly common mistake and could easily apply here. Cheers. Tim. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181210/a741d0cd/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: graycol.gif Type: image/gif Size: 105 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181210/a741d0cd/attachment.gif>