[PATCH] D34978: [GlobalIsel] fix undefined behavior if Action not set.

Igor Breger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 4 05:24:37 PDT 2017


igorb added a comment.

In https://reviews.llvm.org/D34978#798826, @kristof.beyls wrote:

> Hi Igor,
>
> Would it be possible to add a regression test for this?
>  I'm wondering when this fails today. I guess it must be when the target has specified an action for e.g. TypeIdx 0, but not TypeIdx 1?
>  I'm just trying to understand if this should be an assert (if a target hasn't specified something fully enough) or an if statement.
>
> Thanks,
>
> Kristof


Hi Kristof,
I am not sure how to add regression test for this.
Today it fails for example on the follow mir

  # RUN: llc -mtriple=x86_64-linux-gnu -O0 -run-pass=legalizer -global-isel %s -o - | FileCheck %s
    ---
    name:            test_implicit_def
    registers:
    body: |
    bb.0.entry:
      liveins:
  
      %0:_(s64) = G_IMPLICIT_DEF
  ...

In this case target doesn't set any Action for G_IMPLICIT_DEF.
I think the desired behavior of Legalizer is graceful fallback / message and not assert.

  /bin/llc -O0 -mtriple=x86_64-linux-gnu -mattr=+sse2 -global-isel -run-pass=legalizer  tmp.mir                    
  LLVM ERROR: unable to legalize instruction: %vreg0<def>(s64) = G_IMPLICIT_DEF; (in function: test_implicit_def)

Regards,
Igor


https://reviews.llvm.org/D34978





More information about the llvm-commits mailing list