[PATCH] D65079: [GlobalISel][AArch64] Fix narrowScalar for G_ICMP

Petar Avramovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 06:02:57 PDT 2019


Petar.Avramovic added a comment.

@brzycki 
I don't have necessary toolchain for full build, but from error report it is most likely __int128 compare. I made small test that triggers same assert. Does it work now?

@dsanders 
G_ICMP has s1 result(type0) by default. For AArch64 G_ICMP type0 has to be widened to s32.
Narrow Scalar for G_ICMP uses G_SELECT where condition(type1) is result of one of the new G_ICMP instructions. Only s1 for type1 is legal for G_SELECT.
During narrowScalar for G_ICMP we could make G_SELECT with same type1 as a result(type0) for given G_ICMP but then again G_SELECT is only legal for s1(not for s32).
Here I put widen scalar rule for type0 in G_ICMP after clampScalar for type1 since G_ICMP and G_SELECT have different legalization strategies for operand with default s1 type.
Added a test to check that type mismatch assert does not trigger anymore.

Here is the llvm-ir test

  define i1 @test_icmp_s128(i128* %x, i128* %y) {
  entry:
    %0 = load i128, i128* %x
    %1 = load i128, i128* %y
    %cmp = icmp slt i128 %0, %1
    ret i1 %cmp
  }


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65079/new/

https://reviews.llvm.org/D65079





More information about the llvm-commits mailing list