return after trap

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 10:46:15 PDT 2017


On 6/8/2017 4:23 AM, Jonas Paulsson via llvm-commits wrote:
>
> Hi,
>
> SystemZ has some failing tests relating to llvm.trap (with 
> EXPENSIVE_CHECKS).  See https://bugs.llvm.org/show_bug.cgi?id=33047.
>
> One of the problems is that this function
>
> *** IR Dump After Module Verifier ***
> define i32 @f0() {
> entry:
>    tail call void @llvm.trap()
>    ret i32 0
> }
>
> never reaches the ret, but still SystemZTargetLowering::LowerReturn() is called. This results in
>
> BB#0: derived from LLVM BB %entry
>          Trap
>          %vreg0<def> = LHI 0; GR32Bit:%vreg0
>          %R2L<def> = COPY %vreg0; GR32Bit:%vreg0
>          Return %R2L<imp-use>
>
> , and this fails since Trap is a terminator (non-terminator after terminator instruction). It seems that the call 
> to LowerReturn() should never have been made, since it is unreachable.

Other targets solve this problem by not marking their "TRAP" instruction 
as a terminator.  That seems much simpler than special-casing trap 
instrinsics in SelectionDAGBuilder.

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

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


More information about the llvm-commits mailing list