[llvm-dev] Should intrinsics llvm.eh.sjlj.setjmp be with isBarrier flag?

Zheng CZ Chen via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 6 17:29:22 PST 2018


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>;
        %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.

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>

More information about the llvm-dev mailing list