return after trap

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 05:51:58 PDT 2017


Hi Uli,

On 2017-06-09 12:07, Ulrich Weigand wrote:
>
> Hi Jonas,
>
> > I btw see that ARM actually has
> >
> > let isBarrier = 1, isTerminator = 1 in
> > def TRAP
>
> just as a side comment -- can you try running the SystemZ
> tests on ARM and see what happens there?  Do we get the
> same errors?
>
> Bye,
> Ulrich
>

I see that the SystemZ/trap-01.ll test indeed fails the same way on ARM 
(with isMachineVerifierClean() changed to return true):

; Check unconditional traps
define i32 @f0() {
; CHECK-LABEL: f0:
; CHECK-LABEL: .Ltmp0
; CHECK: j .Ltmp0+2
entry:
   tail call void @llvm.trap()
   ret i32 0
}

->

# After Instruction Selection
# Machine code for function f0: IsSSA, TracksLiveness

BB#0: derived from LLVM BB %entry
     TRAP
     %vreg0<def> = MOVi 0, pred:14, pred:%noreg, opt:%noreg; GPR:%vreg0
     %R0<def> = COPY %vreg0; GPR:%vreg0
     MOVPCLR pred:14, pred:%noreg, %R0<imp-use>

# End machine code for function f0.

*** Bad machine code: Non-terminator instruction after the first 
terminator ***
- function:    f0
- basic block: BB#0 entry (0x4eadbc8)
- instruction: %vreg0<def> = MOVi
First terminator was:    TRAP
...

Interestingly enough, a similar test in ARM/trap.ll looks like:

define void @t() nounwind {
entry:
   call void @llvm.trap()
   unreachable
}

, which of course passes also on SystemZ with or without the barrier and 
terminator flag.

So it is then a question if we need to test ret after trap...

/Jonas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170609/b0a2a5ba/attachment.html>


More information about the llvm-commits mailing list